Sha256: 32efc0fb491b359c5dd99e7bff8ca5ac565922a999700542f859ad7770654a0d

Contents?: true

Size: 1.14 KB

Versions: 17

Compression:

Stored size: 1.14 KB

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.tap do |resp|
        resp.status  = response.status
        resp.headers = response.headers
        resp.body    = response.body
      end
    end

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

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

    # Were we redirected?
    alias_method :redirect?, :redirection?

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

    def merge_default_headers(original, *args)
      # Default headers are already applied, no need to merge them a second time.
      # This makes sure that default headers, removed in controller actions, will
      # not be reapplied to the test response.
      original
    end
  end
end

Version data entries

17 entries across 16 versions & 4 rubygems

Version Path
activejob-lock-0.0.2 rails/actionpack/lib/action_dispatch/testing/test_response.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/actionpack-4.2.2/lib/action_dispatch/testing/test_response.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/actionpack-4.2.1/lib/action_dispatch/testing/test_response.rb
actionpack-4.2.2 lib/action_dispatch/testing/test_response.rb
actionpack-4.1.11 lib/action_dispatch/testing/test_response.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/testing/test_response.rb
actionpack-4.1.10 lib/action_dispatch/testing/test_response.rb
actionpack-4.2.1 lib/action_dispatch/testing/test_response.rb
actionpack-4.1.10.rc4 lib/action_dispatch/testing/test_response.rb
actionpack-4.2.1.rc4 lib/action_dispatch/testing/test_response.rb
actionpack-4.1.10.rc3 lib/action_dispatch/testing/test_response.rb
actionpack-4.2.1.rc3 lib/action_dispatch/testing/test_response.rb
actionpack-4.1.10.rc2 lib/action_dispatch/testing/test_response.rb
actionpack-4.2.1.rc2 lib/action_dispatch/testing/test_response.rb
actionpack-4.1.10.rc1 lib/action_dispatch/testing/test_response.rb
actionpack-4.2.1.rc1 lib/action_dispatch/testing/test_response.rb
activejob-lock-0.0.1 rails/actionpack/lib/action_dispatch/testing/test_response.rb