diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/my_controller_test.rb | 27 | ||||
-rw-r--r-- | test/unit/user_test.rb | 24 |
2 files changed, 38 insertions, 13 deletions
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index b2389c39b..5df2932ed 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.rb @@ -61,29 +61,30 @@ class MyControllerTest < Test::Unit::TestCase end def test_change_password - get :account + get :password assert_response :success - assert_template 'account' + assert_template 'password' # non matching password confirmation - post :change_password, :password => 'jsmith', - :new_password => 'hello', - :new_password_confirmation => 'hello2' + post :password, :password => 'jsmith', + :new_password => 'hello', + :new_password_confirmation => 'hello2' assert_response :success - assert_template 'account' + assert_template 'password' assert_tag :tag => "div", :attributes => { :class => "errorExplanation" } # wrong password - post :change_password, :password => 'wrongpassword', - :new_password => 'hello', - :new_password_confirmation => 'hello' - assert_redirected_to 'my/account' + post :password, :password => 'wrongpassword', + :new_password => 'hello', + :new_password_confirmation => 'hello' + assert_response :success + assert_template 'password' assert_equal 'Wrong password', flash[:error] # good password - post :change_password, :password => 'jsmith', - :new_password => 'hello', - :new_password_confirmation => 'hello' + post :password, :password => 'jsmith', + :new_password => 'hello', + :new_password_confirmation => 'hello' assert_redirected_to 'my/account' assert User.try_to_login('jsmith', 'hello') end diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 52776c62f..397bdf68a 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -105,4 +105,28 @@ class UserTest < Test::Unit::TestCase # user with no role assert !@dlopper.role_for_project(Project.find(2)).member? end + + def test_mail_notification_all + @jsmith.mail_notification = true + @jsmith.notified_project_ids = [] + @jsmith.save + @jsmith.reload + assert @jsmith.projects.first.recipients.include?(@jsmith.mail) + end + + def test_mail_notification_selected + @jsmith.mail_notification = false + @jsmith.notified_project_ids = [@jsmith.projects.first.id] + @jsmith.save + @jsmith.reload + assert @jsmith.projects.first.recipients.include?(@jsmith.mail) + end + + def test_mail_notification_none + @jsmith.mail_notification = false + @jsmith.notified_project_ids = [] + @jsmith.save + @jsmith.reload + assert !@jsmith.projects.first.recipients.include?(@jsmith.mail) + end end |