diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/helpers/application_helper_test.rb | 29 | ||||
-rw-r--r-- | test/unit/issue_priority_test.rb | 16 |
2 files changed, 45 insertions, 0 deletions
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 9f2eb8405..31c87daea 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -2329,6 +2329,35 @@ class ApplicationHelperTest < Redmine::HelperTest end end + def test_format_activity_description_should_strip_quoted_text + text = <<~TEXT + John Smith wrote in #note-1: + > The quick brown fox + > jumps over the lazy dog. + + Brick quiz whangs jumpy veldt fox. + + > The five + + > boxing wizards + + > jump quickly. + + The quick onyx goblin jumps over the lazy dwarf. + TEXT + + expected = + 'John Smith wrote in #note-1:<br>' \ + '> The quick brown fox<br>' \ + '> ...<br>' \ + 'Brick quiz whangs jumpy veldt fox.<br>' \ + '> The five<br>' \ + '> ...<br>' \ + 'The quick onyx goblin jumps over the lazy dwarf.<br>' + + assert_equal expected, format_activity_description(text) + end + private def wiki_links_with_special_characters diff --git a/test/unit/issue_priority_test.rb b/test/unit/issue_priority_test.rb index e076afe67..80dc11e1c 100644 --- a/test/unit/issue_priority_test.rb +++ b/test/unit/issue_priority_test.rb @@ -156,4 +156,20 @@ class IssuePriorityTest < ActiveSupport::TestCase IssuePriority.find_by_position_name('highest').destroy assert_equal %w(lowest default high2 highest), IssuePriority.active.to_a.sort.map(&:position_name) end + + def test_high_should_return_false_when_no_default_priority_and_no_active_priorities + IssuePriority.update_all(active: false, is_default: false) + priority = IssuePriority.order(:position).last # Highest priority + assert_nothing_raised do + assert_equal false, priority.high? + end + end + + def test_low_should_return_false_when_no_default_priority_and_no_active_priorities + IssuePriority.update_all(active: false, is_default: false) + priority = IssuePriority.order(:position).first # Lowest priority + assert_nothing_raised do + assert_equal false, priority.low? + end + end end |