You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, my gratitude to @excid3 for this work. It's tremendous and appreciated.
My question originates from a effort to gain confidence my software is doing what I expect (ie, testing). We're adding in
delivery preferences, and I want to be sure that I've configured up my Notifiers (controllers) correctly:
deliver_by :postmark do |config|
config.if = ->{ recipient.notify?(:email)}
I found #318 and loved the test code his approach allows me to write:
it 'sends a notification only to active supplier users' do
# when
described_class.new.handle_event(event)
# then
expect(supplier_user).to have_received_notification MessagePostedNotifier
expect(user_hating_email).not_to have_received_notification MessagePostedNotifier
end
His approach to that custom matcher is to look for Notification records. That doesn't help in this case, because
Notification records are created even when the actual notification message is not sent to the recipient due to the :if clause.
This begs a few questions ---
Q1. Why? Isn't the purpose of the Notification model the idea that a given recipient is being notified on a given channel about a given thing?
Q2. How? Is there another way you would suggest to implement such a matcher, and test that notifications do or do not go out to users under different circumstances?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First off, my gratitude to @excid3 for this work. It's tremendous and appreciated.
My question originates from a effort to gain confidence my software is doing what I expect (ie, testing). We're adding in
delivery preferences, and I want to be sure that I've configured up my Notifiers (controllers) correctly:
as per https://github.com/excid3/noticed?tab=readme-ov-file#tip-capture-user-preferences
I found #318 and loved the test code his approach allows me to write:
His approach to that custom matcher is to look for Notification records. That doesn't help in this case, because
Notification records are created even when the actual notification message is not sent to the recipient due to the
:ifclause.This begs a few questions ---
Q1. Why? Isn't the purpose of the Notification model the idea that a given recipient is being notified on a given channel about a given thing?
Q2. How? Is there another way you would suggest to implement such a matcher, and test that notifications do or do not go out to users under different circumstances?
Thanks for entertaining my inquiry.
Beta Was this translation helpful? Give feedback.
All reactions