mardi 29 septembre 2015

Rake doesn't create Mailer Templates when running RSpec

In our project we have rake task, that creates mailer templates in database. While running all specs, some of them are failing saying that the db record for some mailers don't exist. Any ideas on what could be the reason for this and how to fix it?

Here the example of the task to create Mailer template.

desc "Creates mailer templates"
task create_mailers: :environment do

  MailerTemplate.delete_all

  I18n.available_locales.each do |locale|
    MailerTemplate.create(locale: locale, mailer: "info#action", content: %{<p>Content</p>})
  end
end

Aucun commentaire:

Enregistrer un commentaire