Module: RSpec::Matchers
- Defined in:
- lib/rspec/notifications.rb
Instance Method Summary collapse
-
#emit_notification(pattern) ⇒ Object
(also: #instrument_notification)
Asserts that the block emits a matching ActiveSupport::Notifications event.
Instance Method Details
#emit_notification(pattern) ⇒ Object Also known as: instrument_notification
Asserts that the block emits a matching ActiveSupport::Notifications event.
expect { service.call }.to emit_notification("user.created")
expect { service.call }.to emit_notification("user.created").with(user_id: 1)
expect { service.call }.to emit_notification("user.created").twice
expect { service.call }.to emit_notification("user.*")
expect { service.call }.to emit_notification(/user\./)
pattern may be an exact String, a String with “*” wildcards, or a Regexp.
21 22 23 |
# File 'lib/rspec/notifications.rb', line 21 def emit_notification(pattern) RSpec::Notifications::Matcher.new(pattern) end |