From 1ead9208eebb4048a3e9b8f2aa391aa4db9eac8c Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Wed, 26 Jun 2024 12:03:49 +1000 Subject: [PATCH] Fix rebase issue Fix test by creating a variant instead of relying on some random data from the database. --- spec/services/orders/compare_invoice_service_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/services/orders/compare_invoice_service_spec.rb b/spec/services/orders/compare_invoice_service_spec.rb index 19ad37422a..dd4757bd14 100644 --- a/spec/services/orders/compare_invoice_service_spec.rb +++ b/spec/services/orders/compare_invoice_service_spec.rb @@ -136,7 +136,9 @@ end RSpec.shared_examples "associated attribute changes - line items" do |boolean, type| context "line item changes" do - let(:line_item){ order.line_items.first } + let(:line_item) { order.line_items.first } + let(:variant) { create(:variant) } + context "on quantitity" do before { line_item.update!(quantity: line_item.quantity + 1) } it "returns #{boolean} if a #{type} attribute changes" do @@ -146,7 +148,7 @@ RSpec.shared_examples "associated attribute changes - line items" do |boolean, t end context "on variant id" do - before { line_item.update!(variant_id: Spree::Variant.first.id) } + before { line_item.update!(variant_id: variant.id) } it "returns #{boolean} if a #{type} attribute changes" do order.reload expect(subject).to be boolean