mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Delete dead code Checkout#find_transition
This method is only called from tests and nowhere else in the codebase. We may as well remove it.
This commit is contained in:
@@ -96,14 +96,6 @@ module Spree
|
||||
end
|
||||
end
|
||||
|
||||
def self.find_transition(options = {})
|
||||
return nil if options.nil? || !options.include?(:from) || !options.include?(:to)
|
||||
|
||||
next_event_transitions.detect do |transition|
|
||||
transition[options[:from].to_sym] == options[:to].to_sym
|
||||
end
|
||||
end
|
||||
|
||||
def self.next_event_transitions
|
||||
@next_event_transitions ||= []
|
||||
end
|
||||
|
||||
@@ -6,33 +6,6 @@ describe Spree::Order::Checkout do
|
||||
let(:order) { Spree::Order.new }
|
||||
|
||||
context "with default state machine" do
|
||||
let(:transitions) do
|
||||
[
|
||||
{ address: :delivery },
|
||||
{ delivery: :payment },
|
||||
{ delivery: :confirmation },
|
||||
{ payment: :confirmation },
|
||||
{ confirmation: :complete }
|
||||
]
|
||||
end
|
||||
|
||||
it "has the following transitions" do
|
||||
transitions.each do |transition|
|
||||
transition = Spree::Order.find_transition(from: transition.keys.first,
|
||||
to: transition.values.first)
|
||||
expect(transition).to_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
it "does not have a transition from delivery to confirm" do
|
||||
transition = Spree::Order.find_transition(from: :delivery, to: :confirm)
|
||||
expect(transition).to be_nil
|
||||
end
|
||||
|
||||
it '.find_transition when contract was broken' do
|
||||
expect(Spree::Order.find_transition({ foo: :bar, baz: :dog })).to be_falsy
|
||||
end
|
||||
|
||||
context "#checkout_steps" do
|
||||
context "when payment not required" do
|
||||
before { allow(order).to receive_messages payment_required?: false }
|
||||
|
||||
Reference in New Issue
Block a user