Commit c15c2d0b3e642ae059c1f327b8c86d3edbe37535
1 parent
43810b27
Exists in
master
and in
28 other branches
ActionItem78: testing that the user can't enter a new password with wrong password confirmation
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@692 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
12 additions
and
1 deletions
Show diff stats
test/functional/account_controller_test.rb
| ... | ... | @@ -160,7 +160,7 @@ class AccountControllerTest < Test::Unit::TestCase |
| 160 | 160 | assert_equal users(:ze), @controller.send(:current_user) |
| 161 | 161 | end |
| 162 | 162 | |
| 163 | - def test_should_input_current_password_correctly_to_change_password | |
| 163 | + should 'input current password correctly to change password' do | |
| 164 | 164 | login_as 'ze' |
| 165 | 165 | post :change_password, :current_password => 'wrong', :new_password => 'blabla', :new_password_confirmation => 'blabla' |
| 166 | 166 | assert_response :success |
| ... | ... | @@ -225,6 +225,17 @@ class AccountControllerTest < Test::Unit::TestCase |
| 225 | 225 | assert_template 'invalid_change_password_code' |
| 226 | 226 | end |
| 227 | 227 | |
| 228 | + should 'require password confirmation correctly to enter new pasword' do | |
| 229 | + user = User.create!(:login => 'testuser', :email => 'testuser@example.com', :password => 'test', :password_confirmation => 'test') | |
| 230 | + change = ChangePassword.create!(:login => 'testuser', :email => 'testuser@example.com') | |
| 231 | + | |
| 232 | + post :new_password, :code => change.code, :change_password => { :password => 'onepass', :password_confirmation => 'another_pass' } | |
| 233 | + assert_response :success | |
| 234 | + assert_template 'new_password' | |
| 235 | + | |
| 236 | + assert !User.find(user.id).authenticated?('onepass') | |
| 237 | + end | |
| 238 | + | |
| 228 | 239 | protected |
| 229 | 240 | def create_user(options = {}) |
| 230 | 241 | post :signup, :user => { :login => 'quire', :email => 'quire@example.com', | ... | ... |