def deliver_mail
ServiceMailer.activation().deliver_later
end
deliver_mail method is called from some controller.
I want to test like below - feature test using cucumber and capybara.
step 'push next button' do find("input.submit").click end
Feature: Sending a mail to user
Scenario: mail to a user
When I push next button
Then mail should be sent to a user
actually, when 'push next button' is pushed, mail is sent by deliver_mail method.
when I use deliver_now instead of deliver_later, I can test the code above.
but after I change deliver_now to deliver_later, I can not test.
so I referenced below.
I tried to include 'ActiveJob::TestHelper' like 'include ActiveJob::TestHelper' in spec file.
and i modified step file like this.
step 'push next button' do
perform_enqueued_jobs do
find("input.submit").click
end
end
but still doesn't work.
any hint and advice please.