Skip to content

Commit

Permalink
Added regression tests for package.order and `package.stock_locatio…
Browse files Browse the repository at this point in the history
…n`, to make sure correct values are available.

These depend on spree/spree#5546
  • Loading branch information
mleglise committed Oct 30, 2014
1 parent e7ea8a4 commit 0872fb1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/models/active_shipping_calculator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 0872fb1

Please sign in to comment.