From 1440544b2dbe779804c468674b487d2560d53e70 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Fri, 4 Mar 2016 10:29:26 +1100 Subject: [PATCH] Use persisted models --- spec/models/spree/shipping_method_spec.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spec/models/spree/shipping_method_spec.rb b/spec/models/spree/shipping_method_spec.rb index daae9a2c4e..135b0b0092 100644 --- a/spec/models/spree/shipping_method_spec.rb +++ b/spec/models/spree/shipping_method_spec.rb @@ -37,27 +37,26 @@ module Spree describe "availability" do - let(:sm) { build(:shipping_method) } + let(:sm) { create(:shipping_method) } before do sm.calculator.preferences[:currency] = Spree::Config.currency - end it "is available to orders that match its distributor" do - o = build(:order, ship_address: build(:address), + o = create(:order, ship_address: create(:address), distributor: sm.distributors.first, currency: Spree::Config.currency) sm.should be_available_to_order o end it "is not available to orders that do not match its distributor" do - o = build(:order, ship_address: build(:address), - distributor: build(:distributor_enterprise), currency: Spree::Config.currency) + o = create(:order, ship_address: create(:address), + distributor: create(:distributor_enterprise), currency: Spree::Config.currency) sm.should_not be_available_to_order o end it "is available to orders with no shipping address" do - o = build(:order, ship_address: nil, + o = create(:order, ship_address: nil, distributor: sm.distributors.first, currency: Spree::Config.currency) sm.should be_available_to_order o end