From fade1696e21f58e4e331a15df8800cfd2ad77ae2 Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Tue, 22 Dec 2020 19:07:48 -0800 Subject: [PATCH] update variant spec based on new validation behavior --- spec/models/spree/variant_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/models/spree/variant_spec.rb b/spec/models/spree/variant_spec.rb index 530d8be080..6fc0df044a 100644 --- a/spec/models/spree/variant_spec.rb +++ b/spec/models/spree/variant_spec.rb @@ -535,6 +535,7 @@ module Spree before do product.update_attribute :variant_unit, 'items' product.reload + variant.reload end it "is valid with only unit value set" do @@ -549,10 +550,11 @@ module Spree expect(variant).to be_valid end - it "is invalid when neither unit value nor unit description are set" do + it "sets unit_value to 1.0 before validation if it's nil" do variant.unit_value = nil variant.unit_description = nil - expect(variant).not_to be_valid + expect(variant).to be_valid + expect(variant.unit_value).to eq 1.0 end it "has a valid master variant" do