1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Added failing integration test for XHR invocation of SessionsController#destroy with */*' in the Accept' header.

This commit is contained in:
Alan Larkin 2013-01-05 18:20:35 +00:00
parent 19b5bcbe0f
commit 84b8188db9

View file

@ -517,6 +517,25 @@ class AuthenticationOthersTest < ActionController::IntegrationTest
assert_response :no_content assert_response :no_content
assert_not warden.authenticated?(:user) assert_not warden.authenticated?(:user)
end end
test 'sign out with non-navigational format via XHR does not redirect' do
swap Devise, :navigational_formats => ['*/*', :html] do
sign_in_as_user
xml_http_request :get, destroy_user_session_path, {}, { "HTTP_ACCEPT" => "application/json,text/javascript,*/*" } # NOTE: Bug is triggered by combination of XHR and */*.
assert_response :no_content
assert_not warden.authenticated?(:user)
end
end
# Belt and braces ... Perhaps this test is not necessary?
test 'sign out with navigational format via XHR does redirect' do
swap Devise, :navigational_formats => ['*/*', :html] do
sign_in_as_user
xml_http_request :get, destroy_user_session_path, {}, { "HTTP_ACCEPT" => "text/html,*/*" }
assert_response :redirect
assert_not warden.authenticated?(:user)
end
end
end end
class AuthenticationKeysTest < ActionController::IntegrationTest class AuthenticationKeysTest < ActionController::IntegrationTest