diff --git a/app/models/spree/product_decorator.rb b/app/models/spree/product_decorator.rb index d344e19935..5181bf776d 100644 --- a/app/models/spree/product_decorator.rb +++ b/app/models/spree/product_decorator.rb @@ -185,7 +185,7 @@ Spree::Product.class_eval do if variant_unit_changed? option_types.delete self.class.all_variant_unit_option_types option_types << variant_unit_option_type if variant_unit.present? - variants_including_master.each { |v| v.update_units } + variants_including_master.each &:update_units end end diff --git a/spec/models/spree/product_spec.rb b/spec/models/spree/product_spec.rb index f82d07674f..c6acae0850 100644 --- a/spec/models/spree/product_spec.rb +++ b/spec/models/spree/product_spec.rb @@ -27,12 +27,6 @@ module Spree product.should_not be_valid end - it "defaults available_on to now" do - Timecop.freeze - product = Product.new - product.available_on.should == Time.now - end - it "does not save when master is invalid" do s = create(:supplier_enterprise) t = create(:taxon) @@ -41,6 +35,12 @@ module Spree product.save.should be_false end + it "defaults available_on to now" do + Timecop.freeze + product = Product.new + product.available_on.should == Time.now + end + context "when the product has variants" do let(:product) do product = create(:simple_product)