Sha256: 2967e0b37786a44972769a9b8aa98a09d3b7824dd3a024868a1e881e6ec53e17

Contents?: true

Size: 848 Bytes

Versions: 3

Compression:

Stored size: 848 Bytes

Contents

require 'test_helper'

class ClearanceMailerTest < ActiveSupport::TestCase
  context "A change password email" do
    setup do
      @user  = Factory(:user)
      @user.forgot_password!
      @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.to_s
    end

    should "set its subject" do
      assert_match /Change your password/, @email.subject
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clearance-0.10.3.2 test/models/clearance_mailer_test.rb
clearance-0.10.2 test/models/clearance_mailer_test.rb
clearance-0.10.1 test/models/clearance_mailer_test.rb