diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-19 20:06:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-19 20:06:01 +0000 |
commit | bb5ccb870ce312cada7d8c95f1cba655cd9468ac (patch) | |
tree | 088f27f2fbce9bf65e6566f0d449eb14d3237c9b /test/functional/my_controller_test.rb | |
parent | 34828e18161c9886f87ec17696b55f51983fac9b (diff) | |
download | redmine-bb5ccb870ce312cada7d8c95f1cba655cd9468ac.tar.gz redmine-bb5ccb870ce312cada7d8c95f1cba655cd9468ac.zip |
Removes calls to #assert_template and #assigns in functional tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@15715 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/my_controller_test.rb')
-rw-r--r-- | test/functional/my_controller_test.rb | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index c90acd62c..41d9171b7 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.rb @@ -28,13 +28,13 @@ class MyControllerTest < Redmine::ControllerTest def test_index get :index assert_response :success - assert_template 'page' + assert_select 'h2', 'My page' end def test_page get :page assert_response :success - assert_template 'page' + assert_select 'h2', 'My page' end def test_page_with_timelog_block @@ -65,9 +65,6 @@ class MyControllerTest < Redmine::ControllerTest def test_my_account_should_show_editable_custom_fields get :account assert_response :success - assert_template 'account' - assert_equal User.find(2), assigns(:user) - assert_select 'input[name=?]', 'user[custom_field_values][4]' end @@ -76,9 +73,6 @@ class MyControllerTest < Redmine::ControllerTest get :account assert_response :success - assert_template 'account' - assert_equal User.find(2), assigns(:user) - assert_select 'input[name=?]', 'user[custom_field_values][4]', 0 end @@ -108,7 +102,6 @@ class MyControllerTest < Redmine::ControllerTest assert_redirected_to '/my/account' user = User.find(2) - assert_equal user, assigns(:user) assert_equal "Joe", user.firstname assert_equal "jsmith", user.login assert_equal "0100562500", user.custom_value_for(4).value @@ -143,7 +136,6 @@ class MyControllerTest < Redmine::ControllerTest def test_get_destroy_should_display_the_destroy_confirmation get :destroy assert_response :success - assert_template 'destroy' assert_select 'form[action="/my/account/destroy"]' do assert_select 'input[name=confirm]' end @@ -154,7 +146,6 @@ class MyControllerTest < Redmine::ControllerTest post :destroy end assert_response :success - assert_template 'destroy' end def test_post_destroy_without_confirmation_should_destroy_account @@ -177,30 +168,36 @@ class MyControllerTest < Redmine::ControllerTest def test_change_password get :password assert_response :success - assert_template 'password' + assert_select 'input[type=password][name=password]' + assert_select 'input[type=password][name=new_password]' + assert_select 'input[type=password][name=new_password_confirmation]' + end - # non matching password confirmation + def test_update_password + post :password, :password => 'jsmith', + :new_password => 'secret123', + :new_password_confirmation => 'secret123' + assert_redirected_to '/my/account' + assert User.try_to_login('jsmith', 'secret123') + end + + def test_update_password_with_non_matching_confirmation post :password, :password => 'jsmith', :new_password => 'secret123', :new_password_confirmation => 'secret1234' assert_response :success - assert_template 'password' assert_select_error /Password doesn.*t match confirmation/ + assert User.try_to_login('jsmith', 'jsmith') + end + def test_update_password_with_wrong_password # wrong password post :password, :password => 'wrongpassword', :new_password => 'secret123', :new_password_confirmation => 'secret123' assert_response :success - assert_template 'password' assert_equal 'Wrong password', flash[:error] - - # good password - post :password, :password => 'jsmith', - :new_password => 'secret123', - :new_password_confirmation => 'secret123' - assert_redirected_to '/my/account' - assert User.try_to_login('jsmith', 'secret123') + assert User.try_to_login('jsmith', 'jsmith') end def test_change_password_should_redirect_if_user_cannot_change_its_password @@ -211,7 +208,7 @@ class MyControllerTest < Redmine::ControllerTest assert_redirected_to '/my/account' end - def test_change_password_should_send_security_notification + def test_update_password_should_send_security_notification ActionMailer::Base.deliveries.clear post :password, :password => 'jsmith', :new_password => 'secret123', @@ -227,7 +224,6 @@ class MyControllerTest < Redmine::ControllerTest def test_page_layout get :page_layout assert_response :success - assert_template 'page_layout' end def test_add_block |