From 277067c635ba5fe5019cda9946814dd87138cb44 Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Thu, 9 Aug 2018 16:22:09 +0200 Subject: [PATCH 1/3] Bump ransack dependency up to 2.0 Ransack 2.0.1 is the only version compatible with rails 5.2.1. Rails < 5.0 is no more supported since it needs to use ransack 1.8. This is not an issue since we are not supporting rails < 5.1 anyway. --- core/solidus_core.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/solidus_core.gemspec b/core/solidus_core.gemspec index e4abee7c3ab..a1637bfd34a 100644 --- a/core/solidus_core.gemspec +++ b/core/solidus_core.gemspec @@ -38,6 +38,6 @@ Gem::Specification.new do |s| s.add_dependency 'monetize', '~> 1.1' s.add_dependency 'paperclip', ['>= 4.2', '< 6'] s.add_dependency 'paranoia', '~> 2.4' - s.add_dependency 'ransack', '~> 1.8' + s.add_dependency 'ransack', '~> 2.0' s.add_dependency 'state_machines-activerecord', '~> 0.4' end From ca82f6a703199b38769280da77e1d2dee7a4a979 Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Thu, 9 Aug 2018 17:17:43 +0200 Subject: [PATCH 2/3] Fix specs that fail under Rails 5.2.1 I'm not sure why but previously the association was returning an instance of ActiveRecord::Associations::CollectionProxy that was considered not changed while reloading. Despite that `shipments` call is still returning the same object, they now have a different `object_id` and this could be the root of the problem. I'm not sure if this issue raised up with Rails 5.2.1 or by using the ransack master branch on github. --- core/spec/models/spree/order_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/spec/models/spree/order_spec.rb b/core/spec/models/spree/order_spec.rb index 744b19b710b..251983882cc 100644 --- a/core/spec/models/spree/order_spec.rb +++ b/core/spec/models/spree/order_spec.rb @@ -379,13 +379,13 @@ def merge!(other_order, user = nil) it "does nothing if any shipments are ready" do shipment = create(:shipment, order: subject, state: "ready") - expect { subject.ensure_updated_shipments }.not_to change { subject.reload.shipments } + expect { subject.ensure_updated_shipments }.not_to change { subject.reload.shipments.pluck(:id) } expect { shipment.reload }.not_to raise_error end it "does nothing if any shipments are shipped" do shipment = create(:shipment, order: subject, state: "shipped") - expect { subject.ensure_updated_shipments }.not_to change { subject.reload.shipments } + expect { subject.ensure_updated_shipments }.not_to change { subject.reload.shipments.pluck(:id) } expect { shipment.reload }.not_to raise_error end end @@ -1102,11 +1102,12 @@ def generate it "raises an error if any shipments are ready" do shipment = create(:shipment, order: subject, state: "ready") + expect { expect { subject.create_proposed_shipments }.to raise_error(Spree::Order::CannotRebuildShipments) - }.not_to change { subject.reload.shipments } + }.not_to change { subject.reload.shipments.pluck(:id) } expect { shipment.reload }.not_to raise_error end @@ -1117,7 +1118,7 @@ def generate expect { subject.create_proposed_shipments }.to raise_error(Spree::Order::CannotRebuildShipments) - }.not_to change { subject.reload.shipments } + }.not_to change { subject.reload.shipments.pluck(:id) } expect { shipment.reload }.not_to raise_error end From 3f027e24805f146507d032404a8c727d815d778a Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Mon, 27 Aug 2018 14:49:57 +0200 Subject: [PATCH 3/3] Lock monetize version to 1.8.x This commit comes from @huoxito work on nebulab/solidus#15 (Thanks!) On newer versions monetize requires money 6.12 which has a rewrite of the Money#allocate method that we use in DistrubutedAmount calculator. This is the PR that is causing issues: RubyMoney/money#772 This is the issue we need to be solved before relaxing the dependency again: RubyMoney/monetize#118 --- core/solidus_core.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/solidus_core.gemspec b/core/solidus_core.gemspec index a1637bfd34a..81d4e95b7d1 100644 --- a/core/solidus_core.gemspec +++ b/core/solidus_core.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |s| s.add_dependency 'discard', '~> 1.0' s.add_dependency 'friendly_id', '~> 5.0' s.add_dependency 'kaminari-activerecord', '~> 1.1' - s.add_dependency 'monetize', '~> 1.1' + s.add_dependency 'monetize', '~> 1.8.0' s.add_dependency 'paperclip', ['>= 4.2', '< 6'] s.add_dependency 'paranoia', '~> 2.4' s.add_dependency 'ransack', '~> 2.0'