samedi 22 août 2015

Rails 4 sending emails in the "Test" environment

Everytime I run tests, emails are actually sent. My config/environments/test.rb has this configuration

config.action_mailer.delivery_method = :test

So I thought that whenever I run test, they should not be really sent, but when I run the command

RAILS_ENV="test" rake test

The emails get sent either way. For a moment I thought that maybe I was not using the right environment. But then I deleted completely db/test.sqlite3 and immediately after I run the tests again. The file was again restored, which proves that I am actually running in the test environment.

What is going on? Why are my tests sending real mails? Could it have anything to do with the fact that I am using deliver_now on my app?

Aucun commentaire:

Enregistrer un commentaire