How to Mock ActionMailer
19-May-2022 1032
The Rails ActionMailer is a pretty useful tool.Unfortunately, it's extremely awkward to mock for tests.Since these emails are critical to our business I spent some time looking at how to write clean test to make sure my mailers are called when they should be.The Business CaseSo we're working on a Point of Sale for the the Frosty Treat in Kengsington PEI. The CEO is all about data and dopamine rushes, so they want to get an email every time a banana gets split...for whatever reason.Here's what our test should roughly look like:.
How to Mock ActionMailer #ruby #rubydeveloper #rubyonrails #ActionMailer https://www.rubyonrails.ba/link/how-to-mock-actionmailer