Notifications testing - best practices #306
Unanswered
mkasztelnik
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
At the beginning many thanks for the great library :)
I'm in the process of transitioning from the pure mail sending to notifications. In the beginning, I want to incrementally convert
mail.deliver_later
toMyNotification.deliver_later
. The notifications will have onlydeliver_by :email
declaration (nodeliver_by :database
). After all emails are changed to the notifications more advanced delivery methods will be added.I was struggling with testing the new notifications approach in my application. I added this simple assertion to my application in order to check if the user is notified by the email:
but it seems to me like testing the application on the wrong abstraction level (I'm testing here no notification itself but the delivery method, which is a notification implementation detail).
Do you have any other recommendations/best practices on how to test notifications (without testing record creation in the DB, because the situation is similar to my
assert_notified_by_email
case)?Notification testing like the active job?
I was also thinking about the similarity between
notified
andactive job
. Maybe the library can be extended with the backend support, which in thetest
environment can add notifications to the collection without DB record creation, triggering additional delayed jobs?Do you think this is something worth adding to the library?
Beta Was this translation helpful? Give feedback.
All reactions