summaryrefslogtreecommitdiff
path: root/spec/mailers/password_reset_mailer_spec.rb
blob: 53cac81bbf3155faa9a11927cdc33f3a9d9a155e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require "rails_helper"

describe PasswordResetMailer do
  describe '#send_password_reset_instructions_to' do
    let(:user) { build(:user, reset_password_token: SecureRandom.hex(32)) }
    let(:mail) { PasswordResetMailer.send_password_reset_instructions_to(user) }

    it "adds a subject" do
      expect(mail.subject).to eql("CakeSide - Password Reset Request")
    end

    it "sends to the users email" do
      expect(mail.to).to include(user.email)
    end

    it "should send from the correct address" do
      expect(mail.from).to include('noreply@cakeside.com')
    end

    it "includes their name" do
      expect(mail.body.encoded).to match(CGI.escapeHTML(user.name))
    end
  end
end