Skip to content

Compatibility with rails 3.2.3: cannot use 2 request in one test when param_protected installed #12

Description

@alexeymuranov

This is a new side effect of param_protected with rails 3.2.3:

rails new test_app
cd test_app
rake db:migrate
rails generate controller Boo index

boo_controller.rb:

class BooController < ApplicationController
  def index
    p params
  end
end

boo_controller_test.rb:

require 'test_helper'

class BooControllerTest < ActionController::TestCase
  test "should get index" do
    get :index, { :a => 1 }
    assert_response :success
    get :index, { :a => 2 }
    assert_response :success
    get :index, { :a => 3 }
    assert_response :success
  end
end

Here is the test output without param_protected gem:

§ rake test:functionals
Run options: 

# Running tests:

{"a"=>"1", "controller"=>"boo", "action"=>"index"}
{"a"=>"2", "controller"=>"boo", "action"=>"index"}
{"a"=>"3", "controller"=>"boo", "action"=>"index"}
.

Finished tests in 0.490426s, 2.0390 tests/s, 6.1171 assertions/s.

1 tests, 3 assertions, 0 failures, 0 errors, 0 skips

Here is the output after adding param_protected gem:

§ rake test:functionals
Run options: 

# Running tests:

{"a"=>"1", "controller"=>"boo", "action"=>"index"}
{"a"=>"1", "controller"=>"boo", "action"=>"index"}
{"a"=>"1", "controller"=>"boo", "action"=>"index"}
.

Finished tests in 0.396299s, 2.5233 tests/s, 7.5700 assertions/s.

1 tests, 3 assertions, 0 failures, 0 errors, 0 skips

This does not happen with rails 3.2.2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions