Testing Action Mailer Count in Rails 7 with Hotwire and Turbo Stream (Sytem test case using capybara)

77 Views Asked by At

When using Rails 7 with Hotwire and Turbo Streams, and not utilizing Rails UJS, we encounter an issue when creating system test cases for an action that includes a button with data-turbo: true and turbo-method attributes, combined with HTTP verbs. While this action functions correctly in the UI, we face difficulties when verifying the count of action mailers in Rails using assert_difference in our system test cases.

assert_difference('ActionMailer::Base.deliveries.count', 1) do click_link("approve_school_#{brittinglese.id}") end

Our expectation was that the test cases would run successfully, considering all the conditions and logic involved. However, we faced difficulties in achieving the desired outcome.
We would appreciate any solutions or suggestions to address this problem.

0

There are 0 best solutions below