summaryrefslogtreecommitdiffstats
path: root/test/unit/query_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-02 18:57:17 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-02 18:57:17 +0000
commit346c569f98f53f266f6ab6dffe02cc27a21c33e4 (patch)
tree4c61adb9eb9150b1af69abfa1d04652bc5a5df18 /test/unit/query_test.rb
parent8b8c24e61f37cee0904ad8d44184da58a2f8ca43 (diff)
downloadredmine-346c569f98f53f266f6ab6dffe02cc27a21c33e4.tar.gz
redmine-346c569f98f53f266f6ab6dffe02cc27a21c33e4.zip
Fixed: "None" category issue count is empty while grouping by category (#4308).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3112 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r--test/unit/query_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index f405833d4..31d3cd1dd 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -276,6 +276,32 @@ class QueryTest < ActiveSupport::TestCase
end
end
+ def test_issue_count_by_association_group
+ q = Query.new(:name => '_', :group_by => 'assigned_to')
+ count_by_group = q.issue_count_by_group
+ assert_kind_of Hash, count_by_group
+ assert_equal %w(NilClass User), count_by_group.keys.collect {|k| k.class.name}.uniq.sort
+ assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq
+ assert count_by_group.has_key?(User.find(3))
+ end
+
+ def test_issue_count_by_list_custom_field_group
+ q = Query.new(:name => '_', :group_by => 'cf_1')
+ count_by_group = q.issue_count_by_group
+ assert_kind_of Hash, count_by_group
+ assert_equal %w(NilClass String), count_by_group.keys.collect {|k| k.class.name}.uniq.sort
+ assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq
+ assert count_by_group.has_key?('MySQL')
+ end
+
+ def test_issue_count_by_date_custom_field_group
+ q = Query.new(:name => '_', :group_by => 'cf_8')
+ count_by_group = q.issue_count_by_group
+ assert_kind_of Hash, count_by_group
+ assert_equal %w(Date NilClass), count_by_group.keys.collect {|k| k.class.name}.uniq.sort
+ assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq
+ end
+
def test_label_for
q = Query.new
assert_equal 'assigned_to', q.label_for('assigned_to_id')