Skip to content

Commit

Permalink
Update query sums test expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-contreras committed Feb 26, 2024
1 parent 35eab90 commit 16c5c9b
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions spec/models/query/results_sums_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,21 @@
create(:work_package,
type:,
project:,
estimated_hours: 5,
done_ratio: 10,
estimated_hours: 10,
int_cf.attribute_name => 10,
float_cf.attribute_name => 3.414,
remaining_hours: 3,
remaining_hours: 9,
story_points: 7)
end
let!(:work_package2) do
create(:work_package,
type:,
project:,
assigned_to: current_user,
done_ratio: 50,
estimated_hours: 5,
int_cf.attribute_name => 10,
float_cf.attribute_name => 3.414,
remaining_hours: 3,
remaining_hours: 2.5,
story_points: 7)
end
let!(:work_package3) do
Expand All @@ -78,11 +76,10 @@
project:,
assigned_to: current_user,
responsible: current_user,
done_ratio: 50,
estimated_hours: 5,
int_cf.attribute_name => 10,
float_cf.attribute_name => 3.414,
remaining_hours: 3,
remaining_hours: 2.5,
story_points: 7)
end
let!(:invisible_work_package1) do
Expand Down Expand Up @@ -148,7 +145,7 @@
group_by:)
end
let(:query_results) do
Query::Results.new query
described_class.new query
end

before do
Expand All @@ -158,13 +155,13 @@
describe '#all_total_sums' do
it 'is a hash of all summable columns' do
expect(query_results.all_total_sums)
.to eql(estimated_hours_column => 15.0,
.to eql(estimated_hours_column => 20.0,
int_cf_column => 30,
float_cf_column => 10.24,
material_costs_column => 400.0,
labor_costs_column => 600.0,
overall_costs_column => 1000.0,
remaining_hours_column => 9.0,
remaining_hours_column => 14.0,
story_points_column => 21)
end

Expand All @@ -181,14 +178,14 @@
material_costs_column => 200.0,
labor_costs_column => 300.0,
overall_costs_column => 500.0,
remaining_hours_column => 6.0,
remaining_hours_column => 5.0,
story_points_column => 14)
end
end
end

describe '#all_sums_for_group' do
context 'grouped by assigned_to' do
context 'when grouped by assigned_to' do
let(:group_by) { :assigned_to }

it 'is a hash of sums grouped by user values (and nil) and grouped columns' do
Expand All @@ -199,15 +196,15 @@
material_costs_column => 200.0,
labor_costs_column => 300.0,
overall_costs_column => 500.0,
remaining_hours_column => 6.0,
remaining_hours_column => 5.0,
story_points_column => 14 },
nil => { estimated_hours_column => 5.0,
nil => { estimated_hours_column => 10.0,
int_cf_column => 10,
float_cf_column => 3.41,
material_costs_column => 200.0,
labor_costs_column => 300.0,
overall_costs_column => 500.0,
remaining_hours_column => 3.0,
remaining_hours_column => 9.0,
story_points_column => 7 })
end

Expand All @@ -225,12 +222,12 @@
labor_costs_column => 0.0,
overall_costs_column => 0.0,
story_points_column => 7,
remaining_hours_column => 3.0 })
remaining_hours_column => 2.5 })
end
end
end

context 'grouped by done_ratio' do
context 'when grouped by done_ratio' do
let(:group_by) { :done_ratio }

it 'is a hash of sums grouped by done_ratio values and grouped columns' do
Expand All @@ -241,15 +238,15 @@
material_costs_column => 200.0,
labor_costs_column => 300.0,
overall_costs_column => 500.0,
remaining_hours_column => 6.0,
remaining_hours_column => 5.0,
story_points_column => 14 },
10 => { estimated_hours_column => 5.0,
10 => { estimated_hours_column => 10.0,
int_cf_column => 10,
float_cf_column => 3.41,
material_costs_column => 200.0,
labor_costs_column => 300.0,
overall_costs_column => 500.0,
remaining_hours_column => 3.0,
remaining_hours_column => 9.0,
story_points_column => 7 })
end

Expand All @@ -267,7 +264,7 @@
labor_costs_column => 0.0,
overall_costs_column => 0.0,
story_points_column => 7,
remaining_hours_column => 3.0 })
remaining_hours_column => 2.5 })
end
end
end
Expand Down

0 comments on commit 16c5c9b

Please sign in to comment.