From 01b2cdbc2717af16c536dfdb6d8fc06e75706967 Mon Sep 17 00:00:00 2001 From: "j.wollert" Date: Tue, 26 Oct 2010 14:37:38 +0000 Subject: [PATCH] adds serialize spec git-svn-id: https://dev.finn.de/svn/cockpit/branches/deployment_merge@2095 7926756e-e54e-46e6-9721-ed318f58905e --- spec/models/cost_query/chaining_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/models/cost_query/chaining_spec.rb b/spec/models/cost_query/chaining_spec.rb index 0fbe1ba21b..aacd84dbb1 100644 --- a/spec/models/cost_query/chaining_spec.rb +++ b/spec/models/cost_query/chaining_spec.rb @@ -108,6 +108,20 @@ describe CostQuery do @query.filters.size.should == 3 @query.filters.collect {|f| f.class.underscore_name}.should include "project_id" end + + it "should serialize the chain correctly" do + @query.filter :project_id, :value => Project.all.first.id + @query.filter :cost_type_id, :value => CostQuery::Filter::CostTypeId.available_values.first + @query.filter :category_id, :value => CostQuery::Filter::CategoryId.available_values.first + @query.group_by :activity_id + @query.group_by :cost_object_id + @query.group_by :cost_type_id + [:filters, :group_bys].each do |type| + @query.send(type).each do |chainable| + @query.serialize[type].collect{|c| c[0]}.should include chainable.class.name.demodulize + end + end + end end describe CostQuery::Chainable do