Module: StubServiceNotifications

Defined in:
lib/service_operation/spec/spec_helper.rb

Overview

Stub ServiceNotifications

Instance Method Summary collapse

Instance Method Details

#stub_service_notifications(*args) ⇒ Object

Examples:

stub_service_notifications(YourOperation, email: user.email)
stub_service_notifications(objects: a_hash_including(plain: a_string_matching(/Welcome/)))


15
16
17
18
19
20
21
22
# File 'lib/service_operation/spec/spec_helper.rb', line 15

def stub_service_notifications(*args)
  options, klass = args.reverse
  klass ||= described_class

  stubber = allow(klass).to receive(:service_notifications_post)
  stubber = stubber.with stub_service_notifications_options(options) if options
  stubber.and_return [:created, { test: true }]
end