diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/solidus_subscriptions/subscription_event_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/solidus_subscriptions/subscription_event_spec.rb b/spec/models/solidus_subscriptions/subscription_event_spec.rb new file mode 100644 index 0000000..d4602f3 --- /dev/null +++ b/spec/models/solidus_subscriptions/subscription_event_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +RSpec.describe SolidusSubscriptions::SubscriptionEvent do + describe '#save' do + it 'emits a Solidus event' do + event_klass = class_spy('Spree::Event') + stub_const('Spree::Event', event_klass) + + subscription = create(:subscription) + subscription_event = create(:subscription_event, subscription: subscription, event_type: 'test_event', details: { foo: 'bar' }) + + expect(event_klass).to have_received(:fire).with('solidus_subscriptions.test_event', subscription: subscription_event.subscription, foo: 'bar') + end + end +end |