This project is archived and is in readonly mode.

Changeset [97a178bfa4d5101dca73ae931cc9c77385d8c97e] by Jesse Newland

December 17th, 2008 @ 02:59 PM

Decorate responses from Rack Middleware and Rails Metal for the purposes of integration testing. A test for the following Metal:

class Poller < Rails::Rack::Metal
  def call(env)
    if env["PATH_INFO"] =~ /^\/poller/
      [200, {"Content-Type" => "text/plain"}, "Hello World!"]
    else
      super
    end
  end
end

might be tested like so:

class PollerTest < ActionController::IntegrationTest

test "poller returns hello world" do
  get "/poller"
  assert_response 200
  assert_response :success
  assert_response :ok
  assert_equal "Hello World!", response.body
end

end

[#1588 state:committed]

Signed-off-by: David Heinemeier Hansson david@loudthinking.com http://github.com/rails/rails/co...

Committed by Jesse Newland

  • M actionpack/lib/action_controller/integration.rb
  • M actionpack/test/controller/integration_test.rb

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>