summaryrefslogtreecommitdiffstats
path: root/test/unit/time_entry_query_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-09 19:59:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-09 19:59:54 +0000
commitfd3c08aaa107e2c5a412a06aea6890b147e46aaf (patch)
tree6e55b3f482eddc77ff7cc7f593aa0754e9494a0b /test/unit/time_entry_query_test.rb
parent72f59192525bd6dc3af2cfa00d5b184892335c8d (diff)
downloadredmine-fd3c08aaa107e2c5a412a06aea6890b147e46aaf.tar.gz
redmine-fd3c08aaa107e2c5a412a06aea6890b147e46aaf.zip
Don't preload all query filters (#24787).
git-svn-id: http://svn.redmine.org/redmine/trunk@16170 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/time_entry_query_test.rb')
-rw-r--r--test/unit/time_entry_query_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/time_entry_query_test.rb b/test/unit/time_entry_query_test.rb
index 599aae52c..317f037d0 100644
--- a/test/unit/time_entry_query_test.rb
+++ b/test/unit/time_entry_query_test.rb
@@ -27,6 +27,28 @@ class TimeEntryQueryTest < ActiveSupport::TestCase
:groups_users,
:enabled_modules
+ def test_filter_values_without_project_should_be_arrays
+ q = TimeEntryQuery.new
+ assert_nil q.project
+
+ q.available_filters.each do |name, filter|
+ values = filter.values
+ assert (values.nil? || values.is_a?(Array)),
+ "#values for #{name} filter returned a #{values.class.name}"
+ end
+ end
+
+ def test_filter_values_with_project_should_be_arrays
+ q = TimeEntryQuery.new(:project => Project.find(1))
+ assert_not_nil q.project
+
+ q.available_filters.each do |name, filter|
+ values = filter.values
+ assert (values.nil? || values.is_a?(Array)),
+ "#values for #{name} filter returned a #{values.class.name}"
+ end
+ end
+
def test_cross_project_activity_filter_should_propose_non_active_activities
activity = TimeEntryActivity.create!(:name => 'Disabled', :active => false)
assert !activity.active?