How to check aprill april with rspec

So, my client said that many of the letters go to the wrong person, and I would like to write some functional tests to find and make sure that they receive the letter and what it says in my specifications. I have a mandrill_mailer that uses the mandril api, and before sending it I would like to see what the message is.

For example. Create a new user account -> create a user, and then send a welcome email. in development, it calls RegistrationMailer.new_registration (resource) .deliver which then sends an email to the user:

def new_registration(user) user = User.find_by_email(user["email"]) mandrill_mail template: 'new-registration', subject: 'Welcome to ContentBlvd!', to: { email: user["email"], name: user["full_name"] }, vars: { 'first_name' => user["full_name"], 'unsubscribe' => "#{CONFIG[:protocol]}#{CONFIG[:host]}/unsubscribe?email=#{user.email}" } 

end

In my mail program, how can I check this mail object?
I tried ActionMailer :: Base.deliveries, but it returns nil (Since I use mandrill handwriting ...) So I tried - MandrillMailer :: TemplateMailer.message But no luck ... Thanks for the help.

+8
email ruby-on-rails rspec devise mandrill
source share
2 answers

MandrillMailer currently supports reliable standalone testing . In particular, MandrillMailer.deliveries can now be viewed for expectations or debugging.

+1
source share

You do not need to use Mandrill Stone to send letters using Mandrill. Just use the Rails default Mailer and add the configuration to application.rb or production.rb to use your Mandrill account.

http://help.mandrill.com/entries/21738467-Using-Mandrill-s-SMTP-integration-with-Web-Frameworks

-4
source share

All Articles