summaryrefslogtreecommitdiffstats
path: root/test/unit/tracker_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-05 12:20:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-05 12:20:07 +0000
commit4cecc1beeda2337f50090d9fc0fe1d54fb8d54e2 (patch)
treeae525d4ae044a57c48e01462eb76e34e485ed6e3 /test/unit/tracker_test.rb
parent51a1bf90dda6bc22b29b3801fbb7139b891376e5 (diff)
downloadredmine-4cecc1beeda2337f50090d9fc0fe1d54fb8d54e2.tar.gz
redmine-4cecc1beeda2337f50090d9fc0fe1d54fb8d54e2.zip
Ability to disable standard fields on a per tracker basis (#1091).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9912 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/tracker_test.rb')
-rw-r--r--test/unit/tracker_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb
index 9cf6866a9..91b259827 100644
--- a/test/unit/tracker_test.rb
+++ b/test/unit/tracker_test.rb
@@ -59,6 +59,30 @@ class TrackerTest < ActiveSupport::TestCase
assert_equal [], Tracker.new.issue_statuses
end
+ def test_core_fields_should_be_enabled_by_default
+ tracker = Tracker.new
+ assert_equal Tracker::CORE_FIELDS, tracker.core_fields
+ assert_equal [], tracker.disabled_core_fields
+ end
+
+ def test_core_fields
+ tracker = Tracker.new
+ tracker.core_fields = %w(assigned_to_id due_date)
+
+ assert_equal %w(assigned_to_id due_date), tracker.core_fields
+ assert_equal Tracker::CORE_FIELDS - %w(assigned_to_id due_date), tracker.disabled_core_fields
+ end
+
+ def test_core_fields_should_return_fields_enabled_for_any_tracker
+ trackers = []
+ trackers << Tracker.new(:core_fields => %w(assigned_to_id due_date))
+ trackers << Tracker.new(:core_fields => %w(assigned_to_id done_ratio))
+ trackers << Tracker.new(:core_fields => [])
+
+ assert_equal %w(assigned_to_id due_date done_ratio), Tracker.core_fields(trackers)
+ assert_equal Tracker::CORE_FIELDS - %w(assigned_to_id due_date done_ratio), Tracker.disabled_core_fields(trackers)
+ end
+
def test_sort_should_sort_by_position
a = Tracker.new(:name => 'Tracker A', :position => 2)
b = Tracker.new(:name => 'Tracker B', :position => 1)