mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Switch from state_machine to state_machines gem
The old version is completely unmaintained and does not work with Rails 4.2
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -28,7 +28,7 @@ gem 'json'
|
||||
gem 'money', '< 6.1.0'
|
||||
gem 'paranoia', '~> 2.0'
|
||||
gem 'ransack', '~> 1.8.10'
|
||||
gem 'state_machine', '1.2.0'
|
||||
gem 'state_machines-activerecord'
|
||||
gem 'stringex', '~> 1.5.1'
|
||||
|
||||
gem 'spree_i18n', github: 'openfoodfoundation/spree_i18n', branch: '1-3-stable'
|
||||
|
||||
10
Gemfile.lock
10
Gemfile.lock
@@ -667,7 +667,13 @@ GEM
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
state_machine (1.2.0)
|
||||
state_machines (0.5.0)
|
||||
state_machines-activemodel (0.7.1)
|
||||
activemodel (>= 4.1)
|
||||
state_machines (>= 0.5.0)
|
||||
state_machines-activerecord (0.6.0)
|
||||
activerecord (>= 4.1)
|
||||
state_machines-activemodel (>= 0.5.0)
|
||||
stringex (1.5.1)
|
||||
stripe (5.28.0)
|
||||
temple (0.8.2)
|
||||
@@ -818,7 +824,7 @@ DEPENDENCIES
|
||||
spree_paypal_express!
|
||||
spring
|
||||
spring-commands-rspec
|
||||
state_machine (= 1.2.0)
|
||||
state_machines-activerecord
|
||||
stringex (~> 1.5.1)
|
||||
stripe
|
||||
test-prof
|
||||
|
||||
@@ -34,7 +34,7 @@ module Spree
|
||||
klass = self
|
||||
|
||||
# To avoid a ton of warnings when the state machine is re-defined
|
||||
StateMachine::Machine.ignore_method_conflicts = true
|
||||
StateMachines::Machine.ignore_method_conflicts = true
|
||||
# To avoid multiple occurrences of the same transition being defined
|
||||
# On first definition, state_machines will not be defined
|
||||
state_machines.clear if respond_to?(:state_machines)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
module StateMachine
|
||||
module Integrations
|
||||
module ActiveModel
|
||||
public :around_validation
|
||||
end
|
||||
|
||||
module ActiveRecord
|
||||
public :around_save
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@ require 'mail'
|
||||
require 'paperclip'
|
||||
require 'paranoia'
|
||||
require 'ransack'
|
||||
require 'state_machine'
|
||||
require 'state_machines'
|
||||
|
||||
module Spree
|
||||
mattr_accessor :user_class
|
||||
|
||||
@@ -59,7 +59,7 @@ describe Spree::Order::Checkout do
|
||||
|
||||
it "cannot transition to address without any line items" do
|
||||
expect(order.line_items).to be_blank
|
||||
expect(lambda { order.next! }).to raise_error(StateMachine::InvalidTransition,
|
||||
expect(lambda { order.next! }).to raise_error(StateMachines::InvalidTransition,
|
||||
/#{Spree.t(:there_are_no_items_for_this_order)}/)
|
||||
end
|
||||
|
||||
@@ -82,7 +82,7 @@ describe Spree::Order::Checkout do
|
||||
context "if there are no shipping rates for any shipment" do
|
||||
specify do
|
||||
transition = lambda { order.next! }
|
||||
expect(transition).to raise_error(StateMachine::InvalidTransition,
|
||||
expect(transition).to raise_error(StateMachines::InvalidTransition,
|
||||
/#{Spree.t(:items_cannot_be_shipped)}/)
|
||||
end
|
||||
end
|
||||
@@ -167,7 +167,7 @@ describe Spree::Order::Checkout do
|
||||
it 'raises' do
|
||||
expect { order.restart_checkout! }
|
||||
.to raise_error(
|
||||
StateMachine::InvalidTransition,
|
||||
StateMachines::InvalidTransition,
|
||||
/Cannot transition state via :restart_checkout/
|
||||
)
|
||||
end
|
||||
|
||||
@@ -1321,7 +1321,7 @@ describe Spree::Order do
|
||||
|
||||
it 'raises' do
|
||||
expect { order.restart_checkout! }
|
||||
.to raise_error(StateMachine::InvalidTransition)
|
||||
.to raise_error(StateMachines::InvalidTransition)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ describe OrderCheckoutRestart do
|
||||
it "does not reset the order state nor clears incomplete shipments and payments" do
|
||||
expect do
|
||||
OrderCheckoutRestart.new(order).call
|
||||
end.to raise_error(StateMachine::InvalidTransition)
|
||||
end.to raise_error(StateMachines::InvalidTransition)
|
||||
|
||||
expect(order.state).to eq 'payment'
|
||||
expect(order.shipments.count).to eq 1
|
||||
|
||||
@@ -49,7 +49,7 @@ describe OrderWorkflow do
|
||||
end
|
||||
|
||||
it "raises error" do
|
||||
expect { service.complete! }.to raise_error(StateMachine::InvalidTransition)
|
||||
expect { service.complete! }.to raise_error(StateMachines::InvalidTransition)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user