summaryrefslogtreecommitdiffstats
path: root/test/functional/account_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-11 17:17:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-11 17:17:30 +0000
commit3e706adddddf189060d16c0770a625d6d7065f8b (patch)
treea7018256d89af0dce96d7c813b1b0c8e2146697a /test/functional/account_controller_test.rb
parent5344a35f723bf1501bb6274ef80195154c3e061f (diff)
downloadredmine-3e706adddddf189060d16c0770a625d6d7065f8b.tar.gz
redmine-3e706adddddf189060d16c0770a625d6d7065f8b.zip
Preserve username when authentification failed (#11846).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10609 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/account_controller_test.rb')
-rw-r--r--test/functional/account_controller_test.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index 7b5a449e5..05c3b047b 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -31,6 +31,15 @@ class AccountControllerTest < ActionController::TestCase
User.current = nil
end
+ def test_get_login
+ get :login
+ assert_response :success
+ assert_template 'login'
+
+ assert_select 'input[name=username]'
+ assert_select 'input[name=password]'
+ end
+
def test_login_should_redirect_to_back_url_param
# request.uri is "test.host" in test environment
post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http://test.host/issues/show/1'
@@ -46,9 +55,11 @@ class AccountControllerTest < ActionController::TestCase
post :login, :username => 'admin', :password => 'bad'
assert_response :success
assert_template 'login'
- assert_tag 'div',
- :attributes => { :class => "flash error" },
- :content => /Invalid user or password/
+
+ assert_select 'div.flash.error', :text => /Invalid user or password/
+ assert_select 'input[name=username][value=admin]'
+ assert_select 'input[name=password]'
+ assert_select 'input[name=password][value]', 0
end
def test_login_should_rescue_auth_source_exception