From c00e7eeecfeea3a43e9e0cf9293a8d9f1c678866 Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 21 Jan 2026 17:33:30 +1100 Subject: [PATCH] Add missing spec --- spec/models/spree/line_item_spec.rb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/spec/models/spree/line_item_spec.rb b/spec/models/spree/line_item_spec.rb index 616c95a134..ce400a0462 100644 --- a/spec/models/spree/line_item_spec.rb +++ b/spec/models/spree/line_item_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Spree::LineItem do it { is_expected.to have_many(:adjustments) } end - context '#save' do + describe '#save' do it 'should update inventory, totals, and tax' do # Regression check for Spree #1481 expect(line_item.order).to receive(:create_tax_charge!) @@ -23,7 +23,7 @@ RSpec.describe Spree::LineItem do end end - context '#destroy' do + describe '#destroy' do # Regression test for Spree #1481 it "applies tax adjustments" do expect(line_item.order).to receive(:create_tax_charge!) @@ -42,7 +42,7 @@ RSpec.describe Spree::LineItem do end # Test for Spree #3391 - context '#copy_price' do + describe '#copy_price' do it "copies over a variant's prices" do line_item.price = nil line_item.currency = nil @@ -54,7 +54,7 @@ RSpec.describe Spree::LineItem do end # Test for Spree #3481 - context '#copy_tax_category' do + describe '#copy_tax_category' do it "copies over a variant's tax category" do line_item.tax_category = nil line_item.copy_tax_category @@ -62,7 +62,7 @@ RSpec.describe Spree::LineItem do end end - context '#full_variant_name' do + describe '#full_variant_name' do it "returns variant's full name" do expect(line_item.full_variant_name).to eq(line_item.variant.full_name) end @@ -73,6 +73,17 @@ RSpec.describe Spree::LineItem do end end + describe '#full_product_name' do + it "returns product's full name" do + expect(line_item.full_product_name).to eq(line_item.product.name) + end + + it "uses product.name when product_name is nil" do + line_item.product_name = nil + expect(line_item.full_product_name).to eq(line_item.product.name) + end + end + describe '.currency' do it 'returns the globally configured currency' do line_item.currency == 'USD'