Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a test case to previous commit

  • Loading branch information...
commit 65ef2592f6aa7ad54b5bd86f132fb7673880c199 1 parent ad0aed3
@josevalim josevalim authored
Showing with 12 additions and 3 deletions.
  1. +1 −0  CHANGELOG.rdoc
  2. +11 −3 test/failure_app_test.rb
View
1  CHANGELOG.rdoc
@@ -9,6 +9,7 @@
* valid_for_authentication? must now return a boolean
* bug fix
+ * Ensure the failure app still respects config.relative_url_root
* `/users/sign_in` doesn't choke on protected attributes used to select sign in scope (by @Paymium)
* `failed_attempts` is set to zero after any sign in (including via reset password) (by @rodrigoflores)
* Added token expiration on timeout (by @antiarchitect)
View
14 test/failure_app_test.rb
@@ -29,20 +29,20 @@ def call_failure(env_params={})
end
context 'When redirecting' do
- test 'return to the default redirect location' do
+ test 'returns to the default redirect location' do
call_failure
assert_equal 302, @response.first
assert_equal 'You need to sign in or sign up before continuing.', @request.flash[:alert]
assert_equal 'http://test.host/users/sign_in', @response.second['Location']
end
- test 'return to the default redirect location for wildcard requests' do
+ test 'returns to the default redirect location for wildcard requests' do
call_failure 'action_dispatch.request.formats' => nil, 'HTTP_ACCEPT' => '*/*'
assert_equal 302, @response.first
assert_equal 'http://test.host/users/sign_in', @response.second['Location']
end
- test 'return to the root path if no session path is available' do
+ test 'returns to the root path if no session path is available' do
swap Devise, :router_name => :fake_app do
call_failure :app => RootFailureApp
assert_equal 302, @response.first
@@ -51,6 +51,14 @@ def call_failure(env_params={})
end
end
+ test 'returns to the default redirect location considering the relative url root' do
+ swap Rails.application.config, :relative_url_root => "/sample" do
+ call_failure
+ assert_equal 302, @response.first
+ assert_equal 'http://test.host/sample/users/sign_in', @response.second['Location']
+ end
+ end
+
test 'uses the proxy failure message as symbol' do
call_failure('warden' => OpenStruct.new(:message => :invalid))
assert_equal 'Invalid email or password.', @request.flash[:alert]
Please sign in to comment.
Something went wrong with that request. Please try again.