Sha256: 45a161af60cd7c2d96a237b041b6243ad12c5ecf2cce2ca0b5d52e572d6ab624
Contents?: true
Size: 1.51 KB
Versions: 11
Compression:
Stored size: 1.51 KB
Contents
require 'test_helper' class ClearanceMailerTest < ActiveSupport::TestCase context "A change password email" do setup do @user = Factory(:user) @email = ClearanceMailer.change_password @user end should "be from DO_NOT_REPLY" do assert_match /#{@email.from[0]}/i, Clearance.configuration.mailer_sender end should "be sent to user" do assert_match /#{@user.email}/i, @email.to.first 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.confirmation_token}} assert_match regexp, @email.body end should "set its subject" do assert_match /Change your password/, @email.subject end end context "A confirmation email" do setup do @user = Factory(:user) @email = ClearanceMailer.confirmation @user end should "be from DO_NOT_REPLY" do assert_match /#{@email.from[0]}/i, Clearance.configuration.mailer_sender end should "be sent to user" do assert_match /#{@user.email}/i, @email.to.first end should "set its subject" do assert_match /Account confirmation/, @email.subject end should "contain a link to confirm the user's account" do host = ActionMailer::Base.default_url_options[:host] regexp = %r{http://#{host}/users/#{@user.id}/confirmation/new\?token=#{@user.confirmation_token}} assert_match regexp, @email.body end end end
Version data entries
11 entries across 11 versions & 2 rubygems