summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_relation_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-05 16:14:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-05 16:14:20 +0000
commit5326eb233e3966bb933c7884823e8aac1f94a4c0 (patch)
treed5db54d0cabb642b23e0030246478633eb10c80a /test/unit/issue_relation_test.rb
parentb2ba7db4e1489fca318999214764bac82602fa26 (diff)
downloadredmine-5326eb233e3966bb933c7884823e8aac1f94a4c0.tar.gz
redmine-5326eb233e3966bb933c7884823e8aac1f94a4c0.zip
Overrides IssueRelation#to_s.
git-svn-id: http://svn.redmine.org/redmine/trunk@13563 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_relation_test.rb')
-rw-r--r--test/unit/issue_relation_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/issue_relation_test.rb b/test/unit/issue_relation_test.rb
index 086373bd2..4b6cbc4c9 100644
--- a/test/unit/issue_relation_test.rb
+++ b/test/unit/issue_relation_test.rb
@@ -214,4 +214,23 @@ class IssueRelationTest < ActiveSupport::TestCase
assert_equal '10', to.journals.last.details.last.old_value
assert_nil to.journals.last.details.last.value
end
+
+ def test_to_s_should_return_the_relation_string
+ set_language_if_valid 'en'
+ relation = IssueRelation.find(1)
+ assert_equal "Blocks #9", relation.to_s(relation.issue_from)
+ assert_equal "Blocked by #10", relation.to_s(relation.issue_to)
+ end
+
+ def test_to_s_without_argument_should_return_the_relation_string_for_issue_from
+ set_language_if_valid 'en'
+ relation = IssueRelation.find(1)
+ assert_equal "Blocks #9", relation.to_s
+ end
+
+ def test_to_s_should_accept_a_block_as_custom_issue_formatting
+ set_language_if_valid 'en'
+ relation = IssueRelation.find(1)
+ assert_equal "Blocks Bug #9", relation.to_s {|issue| "#{issue.tracker} ##{issue.id}"}
+ end
end