From d45e21248f222e52a1058651a28eb10b071b9878 Mon Sep 17 00:00:00 2001 From: rkh Date: Thu, 14 Oct 2010 09:04:44 +0000 Subject: [PATCH] Specs for Custom Fields group by git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1930 7926756e-e54e-46e6-9721-ed318f58905e --- spec/models/cost_query/group_by_spec.rb | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/models/cost_query/group_by_spec.rb b/spec/models/cost_query/group_by_spec.rb index 9dadab03ac..e342d3c9d8 100644 --- a/spec/models/cost_query/group_by_spec.rb +++ b/spec/models/cost_query/group_by_spec.rb @@ -16,6 +16,8 @@ describe CostQuery do fixtures :roles fixtures :issue_categories fixtures :versions + fixtures :custom_fields + fixtures :custom_values describe CostQuery::GroupBy do it "should compute group_by on projects" do @@ -200,5 +202,31 @@ describe CostQuery do sql_sizes.sort.should == ruby_sizes.sort sub_sql_sizes.sort.should == sub_ruby_sizes.sort end + + describe CostQuery::GroupBy::CustomField do + before do + CostQuery::GroupBy.all.merge CostQuery::GroupBy::CustomField.all + end + + it "should create classes for custom fields" do + # Would raise a name error + CostQuery::GroupBy::CustomFieldSearchableField + end + + it "includes custom fields classes in CustomField.all" do + CostQuery::GroupBy::CustomField.all. + should include(CostQuery::GroupBy::CustomFieldSearchableField) + end + + it "includes custom fields classes in GroupBy.all" do + CostQuery::GroupBy::CustomField.all. + should include(CostQuery::GroupBy::CustomFieldSearchableField) + end + + it "is usable as filter" do + @query.group_by :custom_field_searchable_field + @query.result.first.count.should == 1 # see fixtures + end + end end end \ No newline at end of file