mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Improve nil-safety in variant naming methods
This commit is contained in:
@@ -432,6 +432,20 @@ describe Spree::Variant do
|
||||
expect(variant.product_and_full_name).to eq "Apple - Pink Lady"
|
||||
end
|
||||
end
|
||||
|
||||
context "when related naming values are nil" do
|
||||
before do
|
||||
product.name = "Apples"
|
||||
product.display_as = nil
|
||||
variant.display_as = nil
|
||||
variant.unit_presentation = nil
|
||||
end
|
||||
|
||||
it "returns empty string or product name" do
|
||||
expect(variant.full_name).to eq ""
|
||||
expect(variant.product_and_full_name).to eq product.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "calculating the price with enterprise fees" do
|
||||
|
||||
Reference in New Issue
Block a user