summaryrefslogtreecommitdiffstats
path: root/test/unit/helpers/issues_helper_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/helpers/issues_helper_test.rb')
-rw-r--r--test/unit/helpers/issues_helper_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/unit/helpers/issues_helper_test.rb b/test/unit/helpers/issues_helper_test.rb
index 327ca0710..c775bc865 100644
--- a/test/unit/helpers/issues_helper_test.rb
+++ b/test/unit/helpers/issues_helper_test.rb
@@ -210,4 +210,36 @@ class IssuesHelperTest < ActionView::TestCase
:old_value => 'error281.txt', :value => nil)
assert_match 'error281.txt', show_detail(detail, true)
end
+
+ def test_show_detail_create_relation
+ detail = JournalDetail.new(:property => 'relation',
+ :prop_key => 'label_precedes',
+ :value => 1)
+ assert_equal "Precedes Bug #1: Can't print recipes added", show_detail(detail, true)
+ assert_match %r{<strong>Precedes</strong> <i><a href="/issues/1" class=".+">Bug #1</a>: Can&#x27;t print recipes</i> added},
+ show_detail(detail, false)
+ non_existed_issue_number = 9999
+ assert_nil Issue.find_by_id(non_existed_issue_number)
+ detail = JournalDetail.new(:property => 'relation',
+ :prop_key => 'label_precedes',
+ :value => non_existed_issue_number)
+ assert_equal "Precedes Issue #{non_existed_issue_number} added", show_detail(detail, true)
+ assert_equal "<strong>Precedes</strong> <i>Issue #{non_existed_issue_number}</i> added", show_detail(detail, false)
+ end
+
+ def test_show_detail_delete_relation
+ detail = JournalDetail.new(:property => 'relation',
+ :prop_key => 'label_precedes',
+ :old_value => 1)
+ assert_equal "Precedes deleted (Bug #1: Can't print recipes)", show_detail(detail, true)
+ assert_match %r{<strong>Precedes</strong> deleted \(<del><i><a href="/issues/1" class=".+">Bug #1</a>: Can&#x27;t print recipes</i></del>\)},
+ show_detail(detail, false)
+ non_existed_issue_number = 9999
+ assert_nil Issue.find_by_id(non_existed_issue_number)
+ detail = JournalDetail.new(:property => 'relation',
+ :prop_key => 'label_precedes',
+ :old_value => non_existed_issue_number)
+ assert_equal "Precedes deleted (Issue 9999)", show_detail(detail, true)
+ assert_equal "<strong>Precedes</strong> deleted (<del><i>Issue 9999</i></del>)", show_detail(detail, false)
+ end
end