summaryrefslogtreecommitdiffstats
path: root/test/unit/query_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-21 18:01:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-21 18:01:11 +0000
commit828e8111cc772111bc156924a985e01221f9e76a (patch)
tree1daa93e7f3e74ff9e92245636917d815c3bf36ec /test/unit/query_test.rb
parent6e7e2ef59b594e3d76305ddb986ce17d63ac1a66 (diff)
downloadredmine-828e8111cc772111bc156924a985e01221f9e76a.tar.gz
redmine-828e8111cc772111bc156924a985e01221f9e76a.zip
Add users to assignee/author filters if they are missing (#3398).
git-svn-id: http://svn.redmine.org/redmine/trunk@14722 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r--test/unit/query_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 30db3abd7..00c3d9a39 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -948,6 +948,28 @@ class QueryTest < ActiveSupport::TestCase
assert_nil q.statement
end
+ def test_available_filters_as_json_should_include_missing_assigned_to_id_values
+ user = User.generate!
+ with_current_user User.find(1) do
+ q = IssueQuery.new
+ q.filters = {"assigned_to_id" => {:operator => '=', :values => user.id.to_s}}
+
+ filters = q.available_filters_as_json
+ assert_include [user.name, user.id.to_s], filters['assigned_to_id']['values']
+ end
+ end
+
+ def test_available_filters_as_json_should_include_missing_author_id_values
+ user = User.generate!
+ with_current_user User.find(1) do
+ q = IssueQuery.new
+ q.filters = {"author_id" => {:operator => '=', :values => user.id.to_s}}
+
+ filters = q.available_filters_as_json
+ assert_include [user.name, user.id.to_s], filters['author_id']['values']
+ end
+ end
+
def test_default_columns
q = IssueQuery.new
assert q.columns.any?