From ade52dd07d2cbdf97cc5f5ab1212bf4db019d8cc Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Thu, 27 Feb 2020 17:40:32 +0000 Subject: [PATCH 1/2] Make ship methods services query work with rails 4, bool_or now results in a boolean and not in t or f as before --- app/models/spree/shipping_method_decorator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/spree/shipping_method_decorator.rb b/app/models/spree/shipping_method_decorator.rb index d79e2b6853..60f1976ed7 100644 --- a/app/models/spree/shipping_method_decorator.rb +++ b/app/models/spree/shipping_method_decorator.rb @@ -41,7 +41,7 @@ Spree::ShippingMethod.class_eval do select("distributor_id"). select("BOOL_OR(spree_shipping_methods.require_ship_address = 'f') AS pickup"). select("BOOL_OR(spree_shipping_methods.require_ship_address = 't') AS delivery"). - map { |sm| [sm.distributor_id.to_i, { pickup: sm.pickup == 't', delivery: sm.delivery == 't' }] } + map { |sm| [sm.distributor_id.to_i, { pickup: sm.pickup, delivery: sm.delivery }] } ] end From b1714d73ef8b4a85a3e5cd501585ad689c55337d Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Thu, 27 Feb 2020 18:01:24 +0000 Subject: [PATCH 2/2] Capitalize 'Method' in the flash message to make specs pass --- spec/features/admin/shipping_methods_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/admin/shipping_methods_spec.rb b/spec/features/admin/shipping_methods_spec.rb index ba4ac46e19..2572194a0b 100644 --- a/spec/features/admin/shipping_methods_spec.rb +++ b/spec/features/admin/shipping_methods_spec.rb @@ -36,7 +36,7 @@ feature 'shipping methods' do expect(page).to have_no_button I18n.t("actions.create") # Then the shipping method should have its distributor set - message = "Shipping method \"Carrier Pidgeon\" has been successfully created!" + message = "Shipping Method \"Carrier Pidgeon\" has been successfully created!" expect(page).to have_flash_message message sm = Spree::ShippingMethod.last @@ -49,7 +49,7 @@ feature 'shipping methods' do scenario "deleting a shipping method" do visit_delete spree.admin_shipping_method_path(@shipping_method) - expect(page).to have_content "Shipping method \"#{@shipping_method.name}\" has been successfully removed!" + expect(page).to have_content "Shipping Method \"#{@shipping_method.name}\" has been successfully removed!" expect(Spree::ShippingMethod.where(id: @shipping_method.id)).to be_empty end @@ -126,7 +126,7 @@ feature 'shipping methods' do click_button I18n.t("actions.create") expect(page).to have_content I18n.t('spree.admin.shipping_methods.edit.editing_shipping_method') - expect(flash_message).to eq I18n.t('successfully_created', resource: 'Shipping method "Teleport"') + expect(flash_message).to eq I18n.t('successfully_created', resource: 'Shipping Method "Teleport"') expect(first('tags-input .tag-list ti-tag-item')).to have_content "local"