diff --git a/Gemfile.lock b/Gemfile.lock index 0d86913a2c..5728364ed3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,7 @@ GIT GIT remote: https://github.com/openfoodfoundation/spree.git - revision: f55722b38db7e706a8521c9091a0e00119bb4d20 + revision: 060d0a5d8b31f68990fa792e0e88910c742d9a96 branch: 2-0-4-stable specs: spree (2.0.4) diff --git a/spec/controllers/spree/api/shipments_controller_spec.rb b/spec/controllers/spree/api/shipments_controller_spec.rb index 88ff8f6ad6..3c71618c50 100644 --- a/spec/controllers/spree/api/shipments_controller_spec.rb +++ b/spec/controllers/spree/api/shipments_controller_spec.rb @@ -25,7 +25,9 @@ describe Spree::Api::ShipmentsController, type: :controller do let(:error_message) { "broken shipments creation" } before do - order.update_attribute(:ship_address_id, order_ship_address.id) + order.update_attribute :ship_address_id, order_ship_address.id + order.update_attribute :distributor, variant.product.supplier + shipment.shipping_method.distributors << variant.product.supplier end sign_in_as_admin! @@ -56,6 +58,7 @@ describe Spree::Api::ShipmentsController, type: :controller do it 'updates existing shipment with variant override if an VO is sent' do hub = create(:distributor_enterprise) order.update_attribute(:distributor, hub) + shipment.shipping_method.distributors << hub variant_override = create(:variant_override, hub: hub, variant: variant) spree_post :create, params diff --git a/spec/features/admin/orders_spec.rb b/spec/features/admin/orders_spec.rb index aecdd4e7c7..f6748903e6 100644 --- a/spec/features/admin/orders_spec.rb +++ b/spec/features/admin/orders_spec.rb @@ -219,7 +219,9 @@ feature %q{ end feature "viewing the edit page" do - let!(:different_shipping_method) { create(:shipping_method, name: "Different Shipping Method") } + let!(:shipping_method_for_distributor1) { create(:shipping_method, name: "Normal", distributors: [distributor1]) } + let!(:different_shipping_method_for_distributor1) { create(:shipping_method, name: "Different", distributors: [distributor1]) } + let!(:shipping_method_for_distributor2) { create(:shipping_method, name: "Other", distributors: [distributor2]) } background do Spree::Config[:enable_receipt_printing?] = true @@ -227,10 +229,12 @@ feature %q{ distributor1.update_attribute(:abn, '12345678') @order = create(:order_with_taxes, distributor: distributor1, + ship_address: create(:address), product_price: 110, tax_rate_amount: 0.1, tax_rate_name: "Tax 1") Spree::TaxRate.adjust(@order) + @order.update_shipping_fees! visit spree.edit_admin_order_path(@order) end @@ -288,14 +292,14 @@ feature %q{ end scenario "can edit shipping method" do - expect(page).to_not have_content different_shipping_method.name + expect(page).to_not have_content different_shipping_method_for_distributor1.name find('.edit-method').click - expect(page).to have_select2 'selected_shipping_rate_id', with_options: [different_shipping_method.name] - select2_select different_shipping_method.name, from: 'selected_shipping_rate_id' + expect(page).to have_select2 'selected_shipping_rate_id', with_options: [shipping_method_for_distributor1.name, different_shipping_method_for_distributor1.name], without_options: [shipping_method_for_distributor2.name] + select2_select different_shipping_method_for_distributor1.name, from: 'selected_shipping_rate_id' find('.save-method').click - expect(page).to have_content different_shipping_method.name + expect(page).to have_content different_shipping_method_for_distributor1.name end scenario "can edit tracking number" do