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:
Matt-Yorkley
2023-06-02 22:09:01 +01:00
committed by Filipe
parent 8d633234f4
commit 4e7fab6914
2 changed files with 0 additions and 35 deletions

View File

@@ -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

View File

@@ -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 }