From 0872fb1a057f83cfd77cb03c259f0e7a1faf7590 Mon Sep 17 00:00:00 2001 From: Marc Leglise Date: Thu, 30 Oct 2014 01:30:36 -0700 Subject: [PATCH] Added regression tests for `package.order` and `package.stock_location`, to make sure correct values are available. These depend on https://github.com/spree/spree/pull/5546 --- spec/models/active_shipping_calculator_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/models/active_shipping_calculator_spec.rb b/spec/models/active_shipping_calculator_spec.rb index 3fe69e6ebe..dd32dda0df 100644 --- a/spec/models/active_shipping_calculator_spec.rb +++ b/spec/models/active_shipping_calculator_spec.rb @@ -7,6 +7,7 @@ module ActiveShipping # NOTE: All specs will use the bogus calculator (no login information needed) let(:address) { FactoryGirl.create(:address) } + let(:stock_location) { FactoryGirl.create(:stock_location) } let!(:order) do order = FactoryGirl.create(:order_with_line_items, :ship_address => address, :line_items_count => 2) order.line_items.first.tap do |line_item| @@ -34,6 +35,8 @@ module ActiveShipping let(:package) { order.shipments.first.to_package } before(:each) do + Spree::StockLocation.destroy_all + stock_location order.create_proposed_shipments order.shipments.count.should == 1 Spree::ActiveShipping::Config.set(:units => "imperial") @@ -42,6 +45,13 @@ module ActiveShipping Rails.cache.clear end + describe "package.order" do + it{ expect(package.order).to eq(order) } + it{ expect(package.order.ship_address).to eq(address) } + it{ expect(package.order.ship_address.country.iso).to eq('US') } + it{ expect(package.stock_location).to eq(stock_location) } + end + describe "available" do context "when rates are available" do let(:rates) do