diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-26 01:25:23 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-26 01:25:23 +0000 |
commit | 113f8b5cf278ff32bd55bf63aafe11c3f5a085f1 (patch) | |
tree | 0f3fc20120aa01c3f32e53874dbb89d009220921 /test/unit/issue_priority_test.rb | |
parent | a679d19709cfbb935b18b66b779ac315b2d3f845 (diff) | |
download | redmine-113f8b5cf278ff32bd55bf63aafe11c3f5a085f1.tar.gz redmine-113f8b5cf278ff32bd55bf63aafe11c3f5a085f1.zip |
Adds a textual css class for issue priorities (#12216).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10720 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_priority_test.rb')
-rw-r--r-- | test/unit/issue_priority_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/issue_priority_test.rb b/test/unit/issue_priority_test.rb index 96d58196c..642203301 100644 --- a/test/unit/issue_priority_test.rb +++ b/test/unit/issue_priority_test.rb @@ -73,4 +73,34 @@ class IssuePriorityTest < ActiveSupport::TestCase priority.expects(:reset_positions_in_list).once priority.move_to = 'higher' end + + def test_clear_position_names_should_set_position_names_to_nil + IssuePriority.clear_position_names + assert IssuePriority.all.all? {|priority| priority.position_name.nil?} + end + + def test_compute_position_names_with_default_priority + IssuePriority.clear_position_names + + IssuePriority.compute_position_names + assert_equal %w(lowest default high3 high2 highest), IssuePriority.active.all.sort.map(&:position_name) + end + + def test_compute_position_names_without_default_priority_should_split_priorities + IssuePriority.clear_position_names + IssuePriority.update_all :is_default => false + + IssuePriority.compute_position_names + assert_equal %w(lowest low2 default high2 highest), IssuePriority.active.all.sort.map(&:position_name) + end + + def test_adding_a_priority_should_update_position_names + priority = IssuePriority.create!(:name => 'New') + assert_equal %w(lowest default high4 high3 high2 highest), IssuePriority.active.all.sort.map(&:position_name) + end + + def test_destroying_a_priority_should_update_position_names + IssuePriority.find_by_position_name('highest').destroy + assert_equal %w(lowest default high2 highest), IssuePriority.active.all.sort.map(&:position_name) + end end |