diff options
author | Nicholas Van Doorn <nick@super.gd> | 2021-07-21 14:29:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-21 14:29:59 -0700 |
commit | b7af04133f796b14bef0781e918d7eb7a46f6c0e (patch) | |
tree | 103c0f248e1dcfe2312bd2e01cd0b5c6288de60d /spec/models/spree/shipment_spec.rb | |
parent | 65d0db3ec71b148777a59f752268d07b345c7e9e (diff) | |
parent | e38197d126137ae5f41fe22018e2fcbd19322037 (diff) |
Merge pull request #88 from SuperGoodSoft/77-add-shipment-shipped-event
#77 Add shipment shipped event
Diffstat (limited to 'spec/models/spree/shipment_spec.rb')
-rw-r--r-- | spec/models/spree/shipment_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/spree/shipment_spec.rb b/spec/models/spree/shipment_spec.rb new file mode 100644 index 0000000..27f213b --- /dev/null +++ b/spec/models/spree/shipment_spec.rb @@ -0,0 +1,16 @@ +RSpec.describe Spree::Shipment do + describe '#update' do + subject { shipment.ship } + + let(:shipment) { create(:shipment, state: 'ready', order: order) } + let(:order) { create :order_with_line_items } + + it 'fires the shipment_shipped event exactly once' do + stub_const('Spree::Event', class_spy(Spree::Event)) + + expect(Spree::Event).to receive(:fire).with('shipment_shipped', shipment: shipment).once + + subject + end + end +end |