From b16ed86b2d85aee4c92808550797b8c73d095bfb Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Sat, 27 Oct 2018 20:34:25 +0100 Subject: [PATCH] Fix shipping_method basic test. Adapt to spree 2 that needs shipping_categories to be set and sets them on the base factory in a after_create block, the build command was not picking it up --- spec/factories.rb | 2 +- spec/models/spree/shipping_method_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/factories.rb b/spec/factories.rb index b7129ee5f6..8a6714d310 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -565,7 +565,7 @@ FactoryBot.modify do end end - factory :shipping_method do + factory :shipping_method, parent: :base_shipping_method do distributors { [Enterprise.is_distributor.first || FactoryBot.create(:distributor_enterprise)] } display_on '' end diff --git a/spec/models/spree/shipping_method_spec.rb b/spec/models/spree/shipping_method_spec.rb index afb0ea59c4..7872772b2b 100644 --- a/spec/models/spree/shipping_method_spec.rb +++ b/spec/models/spree/shipping_method_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' module Spree describe ShippingMethod do it "is valid when built from factory" do - build(:shipping_method).should be_valid + create(:shipping_method).should be_valid end it "can have distributors" do