summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-04-30 03:10:43 +0000
committerGo MAEDA <maeda@farend.jp>2019-04-30 03:10:43 +0000
commit470c1687839be9dfde88f83a159e13eb4a666893 (patch)
treebdf165566af73f9eb55790e73d25d92c6629519b /test
parent3bccfe82271930f3e68cc826c9dee32e1b608ae3 (diff)
downloadredmine-470c1687839be9dfde88f83a159e13eb4a666893.tar.gz
redmine-470c1687839be9dfde88f83a159e13eb4a666893.zip
Changes Query#as_params for more complete serialization (#31276).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@18103 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/query_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 39b4a13e9..287ea7c45 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -2295,4 +2295,19 @@ class QueryTest < ActiveSupport::TestCase
assert_equal [["active", "1"], ["closed", "5"]], project_status_filter[:values]
end
+
+ def test_as_params_should_serialize_query
+ query = IssueQuery.new(name: "_")
+ query.add_filter('subject', '!~', ['asdf'])
+ query.group_by = 'tracker'
+ query.totalable_names = %w(estimated_hours)
+ query.column_names = %w(id subject estimated_hours)
+ assert hsh = query.as_params
+
+ new_query = IssueQuery.build_from_params(hsh)
+ assert_equal query.filters, new_query.filters
+ assert_equal query.group_by, new_query.group_by
+ assert_equal query.column_names, new_query.column_names
+ assert_equal query.totalable_names, new_query.totalable_names
+ end
end