diff --git a/core/spec/models/spree/order/updating_spec.rb b/core/spec/models/spree/order/updating_spec.rb deleted file mode 100644 index 0fc840216f8..00000000000 --- a/core/spec/models/spree/order/updating_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe Spree::Order, type: :model do - let(:order) { create(:order) } - - context "#update!" do - context "when there are update hooks", partial_double_verification: false do - before { Spree::Order.register_update_hook :foo } - after { Spree::Order.update_hooks.clear } - it "should call each of the update hooks" do - expect(order).to receive :foo - order.recalculate - end - end - end -end diff --git a/core/spec/models/spree/order_spec.rb b/core/spec/models/spree/order_spec.rb index 1f8c346fe5a..b8ca370ccc7 100644 --- a/core/spec/models/spree/order_spec.rb +++ b/core/spec/models/spree/order_spec.rb @@ -366,26 +366,19 @@ def merge!(other_order, user = nil) end end - context "add_update_hook", partial_double_verification: false do - before do - Spree::Order.class_eval do - register_update_hook :add_awesome_sauce - end - end + context ".register_update_hook", partial_double_verification: false do + let(:order) { create(:order) } - after do - Spree::Order.update_hooks = Set.new - end + before { Spree::Order.register_update_hook :foo } + after { Spree::Order.update_hooks.clear } - it "calls hook during update" do - order = create(:order) - expect(order).to receive(:add_awesome_sauce) + it "calls hooks during #recalculate" do + expect(order).to receive :foo order.recalculate end - it "calls hook during finalize" do - order = create(:order) - expect(order).to receive(:add_awesome_sauce) + it "calls hook during #finalize!" do + expect(order).to receive :foo order.finalize! end end