Skip to content

Commit

Permalink
Fix Rubocop warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rioug committed Jul 14, 2023
1 parent e88281c commit b04be5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions spec/models/vouchers/flat_rate_spec.rb
Expand Up @@ -6,7 +6,7 @@
let(:enterprise) { build(:enterprise) }

describe 'validations' do
subject { build(:voucher_flat_rate, code: 'new_code', enterprise: enterprise) }
subject { build(:voucher_flat_rate, code: 'new_code', enterprise:) }

it { is_expected.to validate_presence_of(:amount) }
it { is_expected.to validate_numericality_of(:amount).is_greater_than(0) }
Expand All @@ -16,15 +16,15 @@
let(:order) { create(:order_with_totals) }

context 'when order total is more than the voucher' do
subject { create(:voucher_flat_rate, code: 'new_code', enterprise: enterprise, amount: 5) }
subject { create(:voucher_flat_rate, code: 'new_code', enterprise:, amount: 5) }

it 'uses the voucher total' do
expect(subject.compute_amount(order).to_f).to eq(-5)
end
end

context 'when order total is less than the voucher' do
subject { create(:voucher_flat_rate, code: 'new_code', enterprise: enterprise, amount: 20) }
subject { create(:voucher_flat_rate, code: 'new_code', enterprise:, amount: 20) }

it 'matches the order total' do
expect(subject.compute_amount(order).to_f).to eq(-10)
Expand All @@ -34,7 +34,7 @@

describe "#rate" do
subject do
create(:voucher_flat_rate, code: 'new_code', enterprise: enterprise, amount: 5)
create(:voucher_flat_rate, code: 'new_code', enterprise:, amount: 5)
end
let(:order) { create(:order_with_totals) }

Expand Down
6 changes: 3 additions & 3 deletions spec/models/vouchers/percentage_rate_spec.rb
Expand Up @@ -6,7 +6,7 @@
let(:enterprise) { build(:enterprise) }

describe 'validations' do
subject { build(:voucher_percentage_rate, code: 'new_code', enterprise: enterprise) }
subject { build(:voucher_percentage_rate, code: 'new_code', enterprise:) }

it { is_expected.to validate_presence_of(:amount) }
it do
Expand All @@ -18,7 +18,7 @@

describe '#compute_amount' do
subject do
create(:voucher_percentage_rate, code: 'new_code', enterprise: enterprise, amount: 10)
create(:voucher_percentage_rate, code: 'new_code', enterprise:, amount: 10)
end
let(:order) { create(:order_with_totals) }

Expand All @@ -29,7 +29,7 @@

describe "#rate" do
subject do
create(:voucher_percentage_rate, code: 'new_code', enterprise: enterprise, amount: 50)
create(:voucher_percentage_rate, code: 'new_code', enterprise:, amount: 50)
end

it "returns the voucher percentage rate" do
Expand Down

0 comments on commit b04be5f

Please sign in to comment.