summaryrefslogtreecommitdiffstats
path: root/test/unit/journal_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-07-13 09:56:58 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-07-13 09:56:58 +0000
commit7509dda1ff5877f36c63aab35bde4403bc23ccd9 (patch)
tree7f67f08f8ad4e9cf6707febaa26829aec2caf61a /test/unit/journal_test.rb
parent5fbc7f8f1f66259b4161164f81891356068dfd30 (diff)
downloadredmine-7509dda1ff5877f36c63aab35bde4403bc23ccd9.tar.gz
redmine-7509dda1ff5877f36c63aab35bde4403bc23ccd9.zip
Fixed that relations to issues that are not visible are displayed in the issue history (#1005).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12014 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/journal_test.rb')
-rw-r--r--test/unit/journal_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb
index 38d75d723..e3184bf21 100644
--- a/test/unit/journal_test.rb
+++ b/test/unit/journal_test.rb
@@ -175,4 +175,23 @@ class JournalTest < ActiveSupport::TestCase
assert_equal '0', j.old_value
assert_equal '0', j.value
end
+
+ def test_visible_details_should_include_relations_to_visible_issues_only
+ issue = Issue.generate!
+ visible_issue = Issue.generate!
+ IssueRelation.create!(:issue_from => issue, :issue_to => visible_issue, :relation_type => 'relates')
+ hidden_issue = Issue.generate!(:is_private => true)
+ IssueRelation.create!(:issue_from => issue, :issue_to => hidden_issue, :relation_type => 'relates')
+ issue.reload
+ assert_equal 1, issue.journals.size
+ journal = issue.journals.first
+ assert_equal 2, journal.details.size
+
+ visible_details = journal.visible_details(User.anonymous)
+ assert_equal 1, visible_details.size
+ assert_equal visible_issue.id.to_s, visible_details.first.value
+
+ visible_details = journal.visible_details(User.find(2))
+ assert_equal 2, visible_details.size
+ end
end