diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-10 10:33:48 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-10 10:33:48 +0000 |
commit | 7918285ac2e64fe046e590fbb1afb1e1f2fb9422 (patch) | |
tree | a9e81fdf1775055a3a6c2813bfb14a7aedd16373 /test | |
parent | 07da3dc70cc47655ac07294dba714b57e9d61536 (diff) | |
download | redmine-7918285ac2e64fe046e590fbb1afb1e1f2fb9422.tar.gz redmine-7918285ac2e64fe046e590fbb1afb1e1f2fb9422.zip |
Enable updating private_notes property on journal edit form (#22575).
Patch by Takenori TAKAKI.
git-svn-id: http://svn.redmine.org/redmine/trunk@15620 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/journals_controller_test.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb index 097d0bd76..304f205f7 100644 --- a/test/functional/journals_controller_test.rb +++ b/test/functional/journals_controller_test.rb @@ -207,6 +207,39 @@ class JournalsControllerTest < ActionController::TestCase assert_include 'journal-2-notes', response.body end + def test_update_xhr_with_private_notes_checked + @request.session[:user_id] = 1 + xhr :post, :update, :id => 2, :private_notes => '1' + assert_response :success + assert_template 'update' + assert_equal 'text/javascript', response.content_type + assert_equal true, Journal.find(2).private_notes + assert_include 'change-2', response.body + assert_include 'journal-2-private_notes', response.body + end + + def test_update_xhr_with_private_notes_unchecked + Journal.find(2).update_attributes(:private_notes => true) + @request.session[:user_id] = 1 + xhr :post, :update, :id => 2 + assert_response :success + assert_template 'update' + assert_equal 'text/javascript', response.content_type + assert_equal false, Journal.find(2).private_notes + assert_include 'change-2', response.body + assert_include 'journal-2-private_notes', response.body + end + + def test_update_xhr_with_private_notes_changes_and_without_set_private_notes_permission + @request.session[:user_id] = 2 + Role.find(1).add_permission! :edit_issue_notes + Role.find(1).add_permission! :view_private_notes + Role.find(1).remove_permission! :set_notes_private + + xhr :post, :update, :id => 2, :private_notes => '1' + assert_response 403 + end + def test_update_xhr_with_empty_notes_should_delete_the_journal @request.session[:user_id] = 1 assert_difference 'Journal.count', -1 do |