Use preferred_currency instead of preferences[:currency]. Use constant for currency instead of config var.

Conflicts:
	spec/models/spree/shipping_method_spec.rb
This commit is contained in:
Rohan Mitchell
2016-03-04 11:31:18 +11:00
parent 73b53e02fc
commit 780ec598d6

View File

@@ -38,26 +38,27 @@ module Spree
describe "availability" do
let(:sm) { create(:shipping_method) }
let(:currency) { 'AUD' }
before do
sm.calculator.preferences[:currency] = Spree::Config.currency
sm.calculator.preferred_currency = currency
end
it "is available to orders that match its distributor" do
o = create(:order, ship_address: create(:address),
distributor: sm.distributors.first, currency: Spree::Config.currency)
distributor: sm.distributors.first, currency: currency)
sm.should be_available_to_order o
end
it "is not available to orders that do not match its distributor" do
o = create(:order, ship_address: create(:address),
distributor: create(:distributor_enterprise), currency: Spree::Config.currency)
distributor: create(:distributor_enterprise), currency: currency)
sm.should_not be_available_to_order o
end
it "is available to orders with no shipping address" do
o = create(:order, ship_address: nil,
distributor: sm.distributors.first, currency: Spree::Config.currency)
distributor: sm.distributors.first, currency: currency)
sm.should be_available_to_order o
end
end