summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-08-15 07:28:20 +0000
committerGo MAEDA <maeda@farend.jp>2020-08-15 07:28:20 +0000
commit923deb7fa08aa5d1a42da1de7d826cef07a798c9 (patch)
treecf284fcc76b0a5a30c91079fe1c6b2a87523c618 /test/unit
parent9b189a41a2528c28a3bc25f00d1ebd701c097a4a (diff)
downloadredmine-923deb7fa08aa5d1a42da1de7d826cef07a798c9.tar.gz
redmine-923deb7fa08aa5d1a42da1de7d826cef07a798c9.zip
Merged r19975 from trunk to 4.1-stable (#33689).
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@19978 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/issue_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index caeb2f324..1c49d0462 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -898,6 +898,23 @@ class IssueTest < ActiveSupport::TestCase
assert_equal Date.parse('2012-07-14'), issue.due_date
end
+ def test_safe_attributes_notes_should_check_add_issue_notes_permission
+ # With add_issue_notes permission
+ user = User.find(2)
+ issue = Issue.new(:project => Project.find(1))
+ issue.init_journal(user)
+ issue.send :safe_attributes=, {'notes' => 'note'}, user
+ assert_equal 'note', issue.notes
+
+ # Without add_issue_notes permission
+ Role.find(1).remove_permission!(:add_issue_notes)
+ issue = Issue.new(:project => Project.find(1))
+ user.reload
+ issue.init_journal(user)
+ issue.send :safe_attributes=, {'notes' => 'note'}, user
+ assert_equal '', issue.notes
+ end
+
def test_safe_attributes_should_accept_target_tracker_enabled_fields
source = Tracker.find(1)
source.core_fields = []