aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/request_forgery_protection_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-29 11:51:32 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-29 11:51:32 -0200
commita35ec0c02235e7e332f8551a6c94c69ac929a1bf (patch)
tree77235d82964272c8721a62ae046b16279d01f945 /actionpack/test/controller/request_forgery_protection_test.rb
parent069b72aaf04d2caef76f8e71f320716129f2d949 (diff)
parentbaf14ae513337cb185acf865e93dfc48f3aabf6a (diff)
downloadrails-a35ec0c02235e7e332f8551a6c94c69ac929a1bf.tar.gz
rails-a35ec0c02235e7e332f8551a6c94c69ac929a1bf.tar.bz2
rails-a35ec0c02235e7e332f8551a6c94c69ac929a1bf.zip
Merge pull request #18323 from kirs/controller-test-kwargs
Use kwargs in ActionController::TestCase and ActionDispatch::Integration HTTP methods
Diffstat (limited to 'actionpack/test/controller/request_forgery_protection_test.rb')
-rw-r--r--actionpack/test/controller/request_forgery_protection_test.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb
index ea2d35c3f8..8a0eed5a87 100644
--- a/actionpack/test/controller/request_forgery_protection_test.rb
+++ b/actionpack/test/controller/request_forgery_protection_test.rb
@@ -266,19 +266,19 @@ module RequestForgeryProtectionTests
end
def test_should_allow_post_with_token
- assert_not_blocked { post :index, :custom_authenticity_token => @token }
+ assert_not_blocked { post :index, params: { custom_authenticity_token: @token } }
end
def test_should_allow_patch_with_token
- assert_not_blocked { patch :index, :custom_authenticity_token => @token }
+ assert_not_blocked { patch :index, params: { custom_authenticity_token: @token } }
end
def test_should_allow_put_with_token
- assert_not_blocked { put :index, :custom_authenticity_token => @token }
+ assert_not_blocked { put :index, params: { custom_authenticity_token: @token } }
end
def test_should_allow_delete_with_token
- assert_not_blocked { delete :index, :custom_authenticity_token => @token }
+ assert_not_blocked { delete :index, params: { custom_authenticity_token: @token } }
end
def test_should_allow_post_with_token_in_header
@@ -341,7 +341,7 @@ module RequestForgeryProtectionTests
end
assert_cross_origin_not_blocked { xhr :get, :same_origin_js }
- assert_cross_origin_not_blocked { xhr :get, :same_origin_js, format: 'js' }
+ assert_cross_origin_not_blocked { xhr :get, :same_origin_js, format: 'js'}
assert_cross_origin_not_blocked do
@request.accept = 'text/javascript'
xhr :get, :negotiate_same_origin
@@ -350,11 +350,11 @@ module RequestForgeryProtectionTests
# Allow non-GET requests since GET is all a remote <script> tag can muster.
def test_should_allow_non_get_js_without_xhr_header
- assert_cross_origin_not_blocked { post :same_origin_js, custom_authenticity_token: @token }
- assert_cross_origin_not_blocked { post :same_origin_js, format: 'js', custom_authenticity_token: @token }
+ assert_cross_origin_not_blocked { post :same_origin_js, params: { custom_authenticity_token: @token } }
+ assert_cross_origin_not_blocked { post :same_origin_js, params: { format: 'js', custom_authenticity_token: @token } }
assert_cross_origin_not_blocked do
@request.accept = 'text/javascript'
- post :negotiate_same_origin, custom_authenticity_token: @token
+ post :negotiate_same_origin, params: { custom_authenticity_token: @token}
end
end
@@ -543,7 +543,7 @@ class CustomAuthenticityParamControllerTest < ActionController::TestCase
@controller.stubs(:valid_authenticity_token?).returns(:true)
begin
- post :index, :custom_token_name => 'foobar'
+ post :index, params: { custom_token_name: 'foobar' }
assert_equal 0, @logger.logged(:warn).size
ensure
ActionController::Base.logger = @old_logger
@@ -554,7 +554,7 @@ class CustomAuthenticityParamControllerTest < ActionController::TestCase
ActionController::Base.logger = @logger
begin
- post :index, :custom_token_name => 'bazqux'
+ post :index, params: { custom_token_name: 'bazqux' }
assert_equal 1, @logger.logged(:warn).size
ensure
ActionController::Base.logger = @old_logger