diff options
author | Kir Shatrov <shatrov@me.com> | 2015-02-01 16:07:42 +0300 |
---|---|---|
committer | Kir Shatrov <shatrov@me.com> | 2015-02-01 16:07:42 +0300 |
commit | b19999f3a7c39fc1a959cc3c39575014d0fd2835 (patch) | |
tree | 30eca90db38b5744671b15b24e267fba589aa314 /actionpack/test/controller/request_forgery_protection_test.rb | |
parent | 33030ea7cbfa026b0f9f95a2c5d2dd363a7fe6aa (diff) | |
download | rails-b19999f3a7c39fc1a959cc3c39575014d0fd2835.tar.gz rails-b19999f3a7c39fc1a959cc3c39575014d0fd2835.tar.bz2 rails-b19999f3a7c39fc1a959cc3c39575014d0fd2835.zip |
Migrating xhr methods to keyword arguments syntax
in `ActionController::TestCase` and
`ActionDispatch::Integration`
Old syntax:
`xhr :get, :create, params: { id: 1 }`
New syntax example:
`get :create, params: { id: 1 }, xhr: true`
Diffstat (limited to 'actionpack/test/controller/request_forgery_protection_test.rb')
-rw-r--r-- | actionpack/test/controller/request_forgery_protection_test.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb index 8a0eed5a87..88155bb404 100644 --- a/actionpack/test/controller/request_forgery_protection_test.rb +++ b/actionpack/test/controller/request_forgery_protection_test.rb @@ -262,7 +262,7 @@ module RequestForgeryProtectionTests end def test_should_not_allow_xhr_post_without_token - assert_blocked { xhr :post, :index } + assert_blocked { post :index, xhr: true } end def test_should_allow_post_with_token @@ -340,11 +340,11 @@ module RequestForgeryProtectionTests get :negotiate_same_origin 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 { get :same_origin_js, xhr: true } + assert_cross_origin_not_blocked { get :same_origin_js, xhr: true, format: 'js'} assert_cross_origin_not_blocked do @request.accept = 'text/javascript' - xhr :get, :negotiate_same_origin + get :negotiate_same_origin, xhr: true end end @@ -366,11 +366,11 @@ module RequestForgeryProtectionTests get :negotiate_cross_origin end - assert_cross_origin_not_blocked { xhr :get, :cross_origin_js } - assert_cross_origin_not_blocked { xhr :get, :cross_origin_js, format: 'js' } + assert_cross_origin_not_blocked { get :cross_origin_js, xhr: true } + assert_cross_origin_not_blocked { get :cross_origin_js, xhr: true, format: 'js' } assert_cross_origin_not_blocked do @request.accept = 'text/javascript' - xhr :get, :negotiate_cross_origin + get :negotiate_cross_origin, xhr: true end end |