ActionMailer testing


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  1. def setup @user = users(:myfixtureuser) ActionMailer::Base.deliveries = [] end def test_welcome_mail MyMailer.deliver_welcome_email assert !ActionMailer::Base.deliveries.empty? sent = ActionMailer::Base.deliveries.first assert_equal [@user.email], sent.to assert_equal "expected subject", sent.subject assert sent.body =~ /^Welcome to my App/ assert sent.body =~ /^Username: #{@user.login}$/ assert sent.body =~ /^Password: [a-z0-9]{10}$/i end

URL: http://theexciter.com/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.