Skip to content

Commit

Permalink
Merge pull request #3340 from nebulab/kennyadsl/remove-duplicate-specs
Browse files Browse the repository at this point in the history
Remove duplicate Spree::Order.register_update_hook specs
  • Loading branch information
kennyadsl authored Oct 17, 2019
2 parents 0d93620 + c735915 commit b5016eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 33 deletions.
18 changes: 0 additions & 18 deletions core/spec/models/spree/order/updating_spec.rb

This file was deleted.

23 changes: 8 additions & 15 deletions core/spec/models/spree/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b5016eb

Please sign in to comment.