OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/spec/models/cost_query/walker_spec.rb

40 lines
1.1 KiB

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe CostQuery, :reporting_query_helper => true do
minimal_query
before do
FactoryGirl.create(:admin)
project = FactoryGirl.create(:project_with_trackers)
issue = FactoryGirl.create(:issue, project: project)
FactoryGirl.create(:time_entry, issue: issue, project: project)
end
describe CostQuery::Transformer do
it "should walk down row_first" do
@query.group_by :issue_id
@query.column :tweek
@query.row :project_id
@query.row :user_id
result = @query.transformer.row_first.values.first
[:user_id, :project_id, :tweek].each do |field|
result.fields.should include(field)
result = result.values.first
end
end
it "should walk down column_first" do
@query.group_by :issue_id
@query.column :tweek
@query.row :project_id
@query.row :user_id
result = @query.transformer.column_first.values.first
[:tweek, :issue_id].each do |field|
result.fields.should include(field)
result = result.values.first
end
end
end
end