Run Rubocop autocorrect on spec/queries

This commit is contained in:
Manuel Bustillo 2024-12-28 17:36:06 +01:00
parent b85e2ef932
commit 27c7feebee
3 changed files with 11 additions and 7 deletions

@ -14,4 +14,4 @@ AllCops:
Layout/LineLength: Layout/LineLength:
Max: 120 Max: 120
RSpec/ExampleLength: RSpec/ExampleLength:
Max: 10 Max: 30

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024 Manuel Bustillo
require 'rails_helper' require 'rails_helper'
@ -61,8 +63,8 @@ module Expenses
end end
it 'returns the sum of fixed and variable expenses', :aggregate_failures do it 'returns the sum of fixed and variable expenses', :aggregate_failures do
expect(response['total_confirmed']).to eq(100 + 200 + 50 * 2) expect(response['total_confirmed']).to eq(100 + 200 + (50 * 2))
expect(response['total_projected']).to eq(100 + 200 + 11 * 50) expect(response['total_projected']).to eq(100 + 200 + (11 * 50))
expect(response['confirmed_guests']).to eq(2) expect(response['confirmed_guests']).to eq(2)
expect(response['projected_guests']).to eq(2 + 4 + 5) expect(response['projected_guests']).to eq(2 + 4 + 5)
end end

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024 Manuel Bustillo
require 'rails_helper' require 'rails_helper'
@ -5,7 +7,7 @@ require 'rails_helper'
module Groups module Groups
RSpec.describe SummaryQuery do RSpec.describe SummaryQuery do
describe '#call' do describe '#call' do
subject { described_class.new.call } subject(:result) { described_class.new.call }
context 'when there are no groups' do context 'when there are no groups' do
it { is_expected.to eq([]) } it { is_expected.to eq([]) }
@ -17,7 +19,7 @@ module Groups
context 'when there are no guests' do context 'when there are no guests' do
it 'returns the summary of groups' do it 'returns the summary of groups' do
is_expected.to contain_exactly( expect(result).to contain_exactly(
{ 'id' => parent.id, { 'id' => parent.id,
'name' => 'Friends', 'name' => 'Friends',
'icon' => 'icon-1', 'icon' => 'icon-1',
@ -58,11 +60,11 @@ module Groups
create_list(:guest, 8, group: child, status: :invited) create_list(:guest, 8, group: child, status: :invited)
create_list(:guest, 9, group: child, status: :confirmed) create_list(:guest, 9, group: child, status: :confirmed)
create_list(:guest, 10, group: child, status: :declined) create_list(:guest, 10, group: child, status: :declined)
create_list(:guest, 11, group: child, status: :tentative) create_list(:guest, 11, group: child, status: :tentative) # rubocop:disable FactoryBot/ExcessiveCreateList
end end
it 'returns the summary of groups' do it 'returns the summary of groups' do
is_expected.to contain_exactly( expect(result).to contain_exactly(
{ {
'id' => parent.id, 'id' => parent.id,
'name' => 'Friends', 'name' => 'Friends',