149 |
149 |
expire_sudo_mode!
|
150 |
150 |
get '/my/account'
|
151 |
151 |
assert_response :success
|
152 |
|
post '/my/account', :params => {user: { mail: 'newmail@test.com' }}
|
|
152 |
put '/my/account', :params => {user: { mail: 'newmail@test.com' }}
|
153 |
153 |
assert_response :success
|
154 |
154 |
assert_select 'h2', 'Confirm your password to continue'
|
155 |
155 |
assert_select 'form[action="/my/account"]'
|
... | ... | |
157 |
157 |
assert_select '#flash_error', 0
|
158 |
158 |
|
159 |
159 |
# wrong password
|
160 |
|
post '/my/account', :params => {user: { mail: 'newmail@test.com' }, sudo_password: 'wrong'}
|
|
160 |
put '/my/account', :params => {user: { mail: 'newmail@test.com' }, sudo_password: 'wrong'}
|
161 |
161 |
assert_response :success
|
162 |
162 |
assert_select 'h2', 'Confirm your password to continue'
|
163 |
163 |
assert_select 'form[action="/my/account"]'
|
... | ... | |
165 |
165 |
assert_select '#flash_error'
|
166 |
166 |
|
167 |
167 |
# correct password
|
168 |
|
post '/my/account', :params => {user: { mail: 'newmail@test.com' }, sudo_password: 'jsmith'}
|
|
168 |
put '/my/account', :params => {user: { mail: 'newmail@test.com' }, sudo_password: 'jsmith'}
|
169 |
169 |
assert_redirected_to '/my/account'
|
170 |
170 |
assert_equal 'newmail@test.com', User.find_by_login('jsmith').mail
|
171 |
171 |
|
172 |
172 |
# sudo mode should now be active and not require password again
|
173 |
|
post '/my/account', :params => {user: { mail: 'even.newer.mail@test.com' }}
|
|
173 |
put '/my/account', :params => {user: { mail: 'even.newer.mail@test.com' }}
|
174 |
174 |
assert_redirected_to '/my/account'
|
175 |
175 |
assert_equal 'even.newer.mail@test.com', User.find_by_login('jsmith').mail
|
176 |
176 |
end
|