method

capture_notifications

rails latest stable - Class: ActiveSupport::Testing::NotificationAssertions

Method not available on this version

This method is only available on newer versions. The first available version (v8.1.1) is shown here.

capture_notifications(pattern = nil, &block)
public

Capture emitted notifications, optionally filtered by a pattern.

You can capture emitted notifications, optionally filtered by a pattern, which accepts either a string or regexp, and a block.

notifications = capture_notifications("post.submitted") do
  post.submit(title: "Cool Post") # => emits matching notification
end