Compatibility with rails 3.2.3: cannot use 2 request in one test when param_protected installed
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.
Shoot, not sure when I'll have time to look into this. Maybe this weekend. Anyone else want to take a stab? :)
-- C
On Sunday, April 1, 2012 at 6:54 PM, Alexey Muranov wrote:
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 indexboo_controller.rb:
class BooController < ApplicationController def index p params end endboo_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 endHere 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 skipsHere 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 skipsThis does not happen with rails 3.2.2.
Reply to this email directly or view it on GitHub: https://github.com/cjbottaro/param_protected/issues/12