Integration test methods such as ActionDispatch::Integration::Session#get and ActionDispatch::Integration::Session#post return objects of class TestResponse, which represent the HTTP response results of the requested controller actions.
See Response for more information on controller response objects.
[ show source ]
# File actionpack/lib/action_dispatch/testing/test_response.rb, line 9 def self.from_response(response) new.tap do |resp| resp.status = response.status resp.headers = response.headers resp.body = response.body end end
Was there a client client?
[ show source ]
# File actionpack/lib/action_dispatch/testing/test_response.rb, line 132 def client_error? (400..499).include?(response_code) end
Was there a server-side error?
[ show source ]
# File actionpack/lib/action_dispatch/testing/test_response.rb, line 126 def error? (500..599).include?(response_code) end
Was the URL not found?
[ show source ]
# File actionpack/lib/action_dispatch/testing/test_response.rb, line 116 def missing? response_code == 404 end
Were we redirected?
[ show source ]
# File actionpack/lib/action_dispatch/testing/test_response.rb, line 121 def redirect? (300..399).include?(response_code) end
Was the response successful?
[ show source ]
# File actionpack/lib/action_dispatch/testing/test_response.rb, line 111 def success? (200..299).include?(response_code) end