mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Merge pull request #2074 from diminish7/failure_app_test_helper
Test helper was incorrectly returning failure body
This commit is contained in:
commit
50338b34f9
2 changed files with 9 additions and 4 deletions
|
@ -107,8 +107,8 @@ module Devise
|
|||
env["warden.options"] = options
|
||||
Warden::Manager._run_callbacks(:before_failure, env, options)
|
||||
|
||||
status, headers, body = Devise.warden_config[:failure_app].call(env).to_a
|
||||
@controller.send :render, :status => status, :text => body,
|
||||
status, headers, response = Devise.warden_config[:failure_app].call(env).to_a
|
||||
@controller.send :render, :status => status, :text => response.body,
|
||||
:content_type => headers["Content-Type"], :location => headers["Location"]
|
||||
nil # causes process return @response
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class TestHelpersTest < ActionController::TestCase
|
|||
self.status = 306
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test "redirects if attempting to access a page unauthenticated" do
|
||||
get :index
|
||||
assert_redirected_to new_user_session_path
|
||||
|
@ -70,7 +70,7 @@ class TestHelpersTest < ActionController::TestCase
|
|||
get :index
|
||||
assert_redirected_to new_user_session_path
|
||||
end
|
||||
|
||||
|
||||
test "respects custom failure app" do
|
||||
begin
|
||||
Devise.warden_config.failure_app = CustomFailureApp
|
||||
|
@ -81,6 +81,11 @@ class TestHelpersTest < ActionController::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test "returns the body of a failure app" do
|
||||
get :index
|
||||
assert_equal response.body, "<html><body>You are being <a href=\"http://test.host/users/sign_in\">redirected</a>.</body></html>"
|
||||
end
|
||||
|
||||
test "defined Warden after_authentication callback should not be called when sign_in is called" do
|
||||
begin
|
||||
Warden::Manager.after_authentication do |user, auth, opts|
|
||||
|
|
Loading…
Reference in a new issue