summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-10-08 07:28:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-10-08 07:28:45 +0000
commit960b322388300856a6dfd9d2b9f2d054ce47cf57 (patch)
tree1c1a2c4c88dd7e00913bdc26a5f435c52c37dba5 /test
parentbe11a2048bc6f7b7cd19c737936467b15b583a93 (diff)
downloadredmine-960b322388300856a6dfd9d2b9f2d054ce47cf57.tar.gz
redmine-960b322388300856a6dfd9d2b9f2d054ce47cf57.zip
Consider custom fields that correspond to the project only (#24014).
git-svn-id: http://svn.redmine.org/redmine/trunk@15890 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/time_entry_query_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/time_entry_query_test.rb b/test/unit/time_entry_query_test.rb
index 9ca864f72..599aae52c 100644
--- a/test/unit/time_entry_query_test.rb
+++ b/test/unit/time_entry_query_test.rb
@@ -54,4 +54,28 @@ class TimeEntryQueryTest < ActiveSupport::TestCase
query.add_filter('activity_id', '!', [system.id.to_s])
assert_equal 4.0, query.results_scope.sum(:hours)
end
+
+ def test_project_query_should_include_project_issue_custom_fields_only_as_filters
+ global = IssueCustomField.generate!(:is_for_all => true, :is_filter => true)
+ field_on_project = IssueCustomField.generate!(:is_for_all => false, :project_ids => [3], :is_filter => true)
+ field_not_on_project = IssueCustomField.generate!(:is_for_all => false, :project_ids => [1,2], :is_filter => true)
+
+ query = TimeEntryQuery.new(:project => Project.find(3))
+
+ assert_include "issue.cf_#{global.id}", query.available_filters.keys
+ assert_include "issue.cf_#{field_on_project.id}", query.available_filters.keys
+ assert_not_include "issue.cf_#{field_not_on_project.id}", query.available_filters.keys
+ end
+
+ def test_project_query_should_include_project_issue_custom_fields_only_as_columns
+ global = IssueCustomField.generate!(:is_for_all => true, :is_filter => true)
+ field_on_project = IssueCustomField.generate!(:is_for_all => false, :project_ids => [3], :is_filter => true)
+ field_not_on_project = IssueCustomField.generate!(:is_for_all => false, :project_ids => [1,2], :is_filter => true)
+
+ query = TimeEntryQuery.new(:project => Project.find(3))
+
+ assert_include "issue.cf_#{global.id}", query.available_columns.map(&:name).map(&:to_s)
+ assert_include "issue.cf_#{field_on_project.id}", query.available_columns.map(&:name).map(&:to_s)
+ assert_not_include "issue.cf_#{field_not_on_project.id}", query.available_columns.map(&:name).map(&:to_s)
+ end
end