diff options
author | Go MAEDA <maeda@farend.jp> | 2020-05-08 04:46:27 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-05-08 04:46:27 +0000 |
commit | 117ad7e4c2cf380f86167c59c6c8e2d36409c325 (patch) | |
tree | 67b8970d10c21fc913b608e997b008eaa170b8f5 /test | |
parent | c57ba74f2bc2ff2614a6a61b6bee5764ea494217 (diff) | |
download | redmine-117ad7e4c2cf380f86167c59c6c8e2d36409c325.tar.gz redmine-117ad7e4c2cf380f86167c59c6c8e2d36409c325.zip |
Merged r19758 from trunk to 4.1-stable (#33281).
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@19759 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/query_test.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 895398264..dee450718 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -1800,6 +1800,37 @@ class QueryTest < ActiveSupport::TestCase assert_include "cf_#{field.id}".to_sym, q.available_totalable_columns.map(&:name) end + def test_available_totalable_columns_should_sort_in_position_order_for_custom_field + ProjectCustomField.delete_all + cf_pos3 = ProjectCustomField.generate!(:position => 3, :is_for_all => true, :field_format => 'int') + cf_pos4 = ProjectCustomField.generate!(:position => 4, :is_for_all => true, :field_format => 'float') + cf_pos1 = ProjectCustomField.generate!(:position => 1, :is_for_all => true, :field_format => 'float') + cf_pos2 = ProjectCustomField.generate!(:position => 2, :is_for_all => true, :field_format => 'int') + q = ProjectQuery.new + custom_field_columns = q.available_totalable_columns.select{|column| column.is_a?(QueryCustomFieldColumn)} + assert_equal [cf_pos1, cf_pos2, cf_pos3, cf_pos4], custom_field_columns.collect(&:custom_field) + + IssueCustomField.delete_all + cf_pos3 = IssueCustomField.generate!(:position => 3, :is_for_all => true, :field_format => 'int') + cf_pos4 = IssueCustomField.generate!(:position => 4, :is_for_all => true, :field_format => 'float') + cf_pos1 = IssueCustomField.generate!(:position => 1, :is_for_all => true, :field_format => 'float') + cf_pos2 = IssueCustomField.generate!(:position => 2, :is_for_all => true, :field_format => 'int') + q = IssueQuery.new + custom_field_columns = q.available_totalable_columns.select{|column| column.is_a?(QueryCustomFieldColumn)} + assert_equal [cf_pos1, cf_pos2, cf_pos3, cf_pos4], custom_field_columns.collect(&:custom_field) + + ProjectCustomField.delete_all + IssueCustomField.delete_all + TimeEntryCustomField.delete_all + cf_pos3 = TimeEntryCustomField.generate!(:position => 3, :is_for_all => true, :field_format => 'int') + cf_pos4 = TimeEntryCustomField.generate!(:position => 4, :is_for_all => true, :field_format => 'float') + cf_pos1 = TimeEntryCustomField.generate!(:position => 1, :is_for_all => true, :field_format => 'float') + cf_pos2 = TimeEntryCustomField.generate!(:position => 2, :is_for_all => true, :field_format => 'int') + q = TimeEntryQuery.new + custom_field_columns = q.available_totalable_columns.select{|column| column.is_a?(QueryCustomFieldColumn)} + assert_equal [cf_pos1, cf_pos2, cf_pos3, cf_pos4], custom_field_columns.collect(&:custom_field) + end + def test_total_for_estimated_hours Issue.delete_all Issue.generate!(:estimated_hours => 5.5) |