summaryrefslogtreecommitdiffstats
path: root/test/unit/query_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-21 21:46:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-21 21:46:54 +0000
commit703b0ec422bbb9bac775254e8e284a4b145551e2 (patch)
treeab10ca58156f7467be21335d11666f2150467c9f /test/unit/query_test.rb
parent3d76a67a2e108ea64618670d4ece5de0c2253436 (diff)
downloadredmine-703b0ec422bbb9bac775254e8e284a4b145551e2.tar.gz
redmine-703b0ec422bbb9bac775254e8e284a4b145551e2.zip
Fixed: 500 error on issue query grouped by a custom field that was deleted (#7144).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4553 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r--test/unit/query_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 173367a4b..4d85a2b2b 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -235,6 +235,22 @@ class QueryTest < ActiveSupport::TestCase
q = Query.new
assert q.groupable_columns.detect {|c| c.is_a? QueryCustomFieldColumn}
end
+
+ def test_grouped_with_valid_column
+ q = Query.new(:group_by => 'status')
+ assert q.grouped?
+ assert_not_nil q.group_by_column
+ assert_equal :status, q.group_by_column.name
+ assert_not_nil q.group_by_statement
+ assert_equal 'status', q.group_by_statement
+ end
+
+ def test_grouped_with_invalid_column
+ q = Query.new(:group_by => 'foo')
+ assert !q.grouped?
+ assert_nil q.group_by_column
+ assert_nil q.group_by_statement
+ end
def test_default_sort
q = Query.new