From 971723964e05d8d576d20be9aeb2dd5d1e02a5db Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Thu, 2 Oct 2014 17:49:57 +1000 Subject: [PATCH] Update outdated spec --- spec/models/spree/product_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/models/spree/product_spec.rb b/spec/models/spree/product_spec.rb index 7eb5b777ac..57327b75ad 100644 --- a/spec/models/spree/product_spec.rb +++ b/spec/models/spree/product_spec.rb @@ -28,7 +28,12 @@ module Spree product = Product.new supplier_id: s.id, name: "Apples", price: 1, primary_taxon_id: t.id, variant_unit: "weight", variant_unit_scale: 1000, unit_value: 1 product.on_hand = "10,000" expect(product.save).to be_false - expect(product.errors[:count_on_hand]).to include "is not a number" + + # It is expected that master variant :count_on_hand should cause the failure to save, and it does. However, this broke with the addition of + # the :ensure_standard_variant callback. Evidently, normal variants are checked and their errors added to the product model before the + # save_master callback on product is run. Therefore, the error that is raised here is one on a normal variant, rather than one on master. + # expect(product.errors[:count_on_hand]).to include "is not a number" + expect(product.errors[:"variants.count_on_hand"]).to include "is not a number" end it "defaults available_on to now" do