Fix failing specs related to requiring distributor for payment method

This commit is contained in:
Rob H
2014-07-23 16:06:02 +10:00
parent 6b73eb435c
commit 40d290951c
3 changed files with 7 additions and 5 deletions

View File

@@ -113,7 +113,7 @@ feature %q{
e2 = create(:enterprise)
eg1 = create(:enterprise_group, name: 'eg1')
eg2 = create(:enterprise_group, name: 'eg2')
payment_method = create(:payment_method, distributors: [])
payment_method = create(:payment_method, distributors: [e2])
shipping_method = create(:shipping_method, distributors: [e2])
enterprise_fee = create(:enterprise_fee, enterprise: @enterprise )

View File

@@ -21,7 +21,7 @@ feature %q{
fill_in 'payment_method_name', :with => 'Cheque payment method'
select @distributors[0].name, :from => 'payment_method_distributor_ids', visible: false
check "payment_method_distributor_ids_#{@distributors[0].id}"
click_button 'Create'
flash_message.should == 'Payment Method has been successfully created!'

View File

@@ -22,9 +22,11 @@ describe Spree::Order do
end
describe "Payment methods" do
let(:order) { build(:order, distributor: create(:distributor_enterprise)) }
let(:pm1) { create(:payment_method, distributors: [order.distributor])}
let(:pm2) { create(:payment_method, distributors: [])}
let(:order_distributor) { create(:distributor_enterprise) }
let(:some_other_distributor) { create(:distributor_enterprise) }
let(:order) { build(:order, distributor: order_distributor) }
let(:pm1) { create(:payment_method, distributors: [order_distributor])}
let(:pm2) { create(:payment_method, distributors: [some_other_distributor])}
it "finds the correct payment methods" do
Spree::PaymentMethod.stub(:available).and_return [pm1, pm2]