Commit 17b63cd961686b1e9ea3e045e0219ede70a5547e
1 parent
e186c5d3
Exists in
master
and in
29 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,7 +92,7 @@ class AccountController < PublicController | ||
92 | @change_password = ChangePassword.find_by_code(params[:code]) | 92 | @change_password = ChangePassword.find_by_code(params[:code]) |
93 | 93 | ||
94 | unless @change_password | 94 | unless @change_password |
95 | - render :action => 'invalid_change_password_code' | 95 | + render :action => 'invalid_change_password_code', :status => 403 |
96 | return | 96 | return |
97 | end | 97 | end |
98 | 98 |
test/functional/account_controller_test.rb
@@ -194,6 +194,9 @@ class AccountControllerTest < Test::Unit::TestCase | @@ -194,6 +194,9 @@ class AccountControllerTest < Test::Unit::TestCase | ||
194 | should 'provide interface for entering new password' do | 194 | should 'provide interface for entering new password' do |
195 | change = ChangePassword.new | 195 | change = ChangePassword.new |
196 | ChangePassword.expects(:find_by_code).with('osidufgiashfkjsadfhkj99999').returns(change) | 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 | get :new_password, :code => 'osidufgiashfkjsadfhkj99999' | 201 | get :new_password, :code => 'osidufgiashfkjsadfhkj99999' |
199 | assert_equal change, assigns(:change_password) | 202 | assert_equal change, assigns(:change_password) |
@@ -217,9 +220,9 @@ class AccountControllerTest < Test::Unit::TestCase | @@ -217,9 +220,9 @@ class AccountControllerTest < Test::Unit::TestCase | ||
217 | should 'require a valid change_password code' do | 220 | should 'require a valid change_password code' do |
218 | ChangePassword.destroy_all | 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 | end | 226 | end |
224 | 227 | ||
225 | protected | 228 | protected |