Sha256: b5317ebb1ccfdb52c7292ec7ba03c3c9464486cb9f748cc45b15f5658cd5fa72
Contents?: true
Size: 1.34 KB
Versions: 21
Compression:
Stored size: 1.34 KB
Contents
require 'test_helper' class HeadstartMailerTest < ActiveSupport::TestCase context "A change password email" do setup do @user = Factory(:user) @user.forgot_password! HeadstartMailer.deliver_mimi_change_password @user @email = ActionMailer::Base.deliveries.last end should "be from DO_NOT_REPLY" do assert_equal Headstart.configuration.mailer_sender, @email.from end should "be sent to user" do assert_match /#{@user.email}/i, @email.recipients end should "contain a link to edit the user's password" do host = ActionMailer::Base.default_url_options[:host] regexp = %r{http://#{host}/users/#{@user.id}/password/edit\?token=#{@user.password_reset_token}} assert_match regexp, @email.body[:url] end should "set its subject" do assert_match /Change your password/, @email.subject end end context "A welcome email" do setup do @user = Factory(:user) Delayed::Job.work_off @email = ActionMailer::Base.deliveries.last end should "be from DO_NOT_REPLY" do assert_equal Headstart.configuration.mailer_sender, @email.from end should "be sent to user" do assert_match /#{@user.email}/i, @email.recipients end should "set its subject" do assert_match /welcome/i, @email.subject end end end
Version data entries
21 entries across 21 versions & 1 rubygems