From 314e464c3fb451ac83ced0f853539611d0f5fa3a Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Tue, 27 Aug 2013 10:53:59 +1000 Subject: [PATCH] Add failing spec for admin creatin a shipping method owned by a distributor --- spec/features/admin/shipping_methods_spec.rb | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spec/features/admin/shipping_methods_spec.rb b/spec/features/admin/shipping_methods_spec.rb index fc36554af3..789ebbfe9c 100644 --- a/spec/features/admin/shipping_methods_spec.rb +++ b/spec/features/admin/shipping_methods_spec.rb @@ -9,6 +9,27 @@ feature 'shipping methods' do @sm = create(:shipping_method) end + scenario "creating a shipping method owned by a distributor" do + # Given a distributor + distributor = create(:distributor_enterprise, name: 'Aeronautical Adventures') + + # When I create a shipping method and set the distributor + visit new_admin_shipping_method_path + fill_in :name, with: 'Carrier Pidgeon' + select 'Aeronautical Adventures', from: 'shipping_method_distributor_id' + click_button 'Create' + + # Then the shipping method should have its distributor set + flash_message.should == 'Your shipping method has been created' + sm = Spree::ShippingMethod.last + sm.name.should == 'Carrier Pidgeon' + sm.distributor.should == distributor + end + + it "shipping method requires distributor" + it "at checkout, user can only see shipping methods for their current distributor (checkout spec)" + + scenario "deleting a shipping method" do visit_delete spree.admin_shipping_method_path(@sm)