Commit 17b63cd961686b1e9ea3e045e0219ede70a5547e
1 parent
e186c5d3
Exists in
master
and in
28 other branches
ActionItem78: all tests passing now
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@646 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
7 additions
and
4 deletions
Show diff stats
app/controllers/public/account_controller.rb
| ... | ... | @@ -92,7 +92,7 @@ class AccountController < PublicController |
| 92 | 92 | @change_password = ChangePassword.find_by_code(params[:code]) |
| 93 | 93 | |
| 94 | 94 | unless @change_password |
| 95 | - render :action => 'invalid_change_password_code' | |
| 95 | + render :action => 'invalid_change_password_code', :status => 403 | |
| 96 | 96 | return |
| 97 | 97 | end |
| 98 | 98 | ... | ... |
test/functional/account_controller_test.rb
| ... | ... | @@ -194,6 +194,9 @@ class AccountControllerTest < Test::Unit::TestCase |
| 194 | 194 | should 'provide interface for entering new password' do |
| 195 | 195 | change = ChangePassword.new |
| 196 | 196 | ChangePassword.expects(:find_by_code).with('osidufgiashfkjsadfhkj99999').returns(change) |
| 197 | + person = mock | |
| 198 | + person.stubs(:identifier).returns('joe') | |
| 199 | + change.stubs(:requestor).returns(person) | |
| 197 | 200 | |
| 198 | 201 | get :new_password, :code => 'osidufgiashfkjsadfhkj99999' |
| 199 | 202 | assert_equal change, assigns(:change_password) |
| ... | ... | @@ -217,9 +220,9 @@ class AccountControllerTest < Test::Unit::TestCase |
| 217 | 220 | should 'require a valid change_password code' do |
| 218 | 221 | ChangePassword.destroy_all |
| 219 | 222 | |
| 220 | - assert_raise RuntimeError do | |
| 221 | - get :new_password, :code => 'dontexist' | |
| 222 | - end | |
| 223 | + get :new_password, :code => 'dontexist' | |
| 224 | + assert_response 403 | |
| 225 | + assert_template 'invalid_change_password_code' | |
| 223 | 226 | end |
| 224 | 227 | |
| 225 | 228 | protected | ... | ... |