Sha256: 7a07c6d3002cd44e1526e5ba9fe01cfeec75332c36b30a875d4b273952310e3a

Contents?: true

Size: 845 Bytes

Versions: 8

Compression:

Stored size: 845 Bytes

Contents

module ActionDispatch
  # 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.
  class TestResponse < Response
    def self.from_response(response)
      new response.status, response.headers, response.body
    end

    # Was the response successful?
    alias_method :success?, :successful?

    # Was the URL not found?
    alias_method :missing?, :not_found?

    # Was there a server-side error?
    alias_method :error?, :server_error?

    attr_writer :response_parser # :nodoc:

    def parsed_body
      @parsed_body ||= @response_parser.call(body)
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/actionpack-5.0.0/lib/action_dispatch/testing/test_response.rb
actionpack-5.0.0.1 lib/action_dispatch/testing/test_response.rb
actionpack-5.0.0 lib/action_dispatch/testing/test_response.rb
actionpack-5.0.0.rc2 lib/action_dispatch/testing/test_response.rb
actionpack-5.0.0.racecar1 lib/action_dispatch/testing/test_response.rb
actionpack-5.0.0.rc1 lib/action_dispatch/testing/test_response.rb
actionpack-5.0.0.beta4 lib/action_dispatch/testing/test_response.rb
actionpack-5.0.0.beta3 lib/action_dispatch/testing/test_response.rb