master
 1require "rails_helper"
 2
 3describe PasswordResetMailer do
 4  describe '#send_password_reset_instructions_to' do
 5    let(:user) { build(:user, reset_password_token: SecureRandom.hex(32)) }
 6    let(:mail) { PasswordResetMailer.send_password_reset_instructions_to(user) }
 7
 8    it "adds a subject" do
 9      expect(mail.subject).to eql("CakeSide - Password Reset Request")
10    end
11
12    it "sends to the users email" do
13      expect(mail.to).to include(user.email)
14    end
15
16    it "should send from the correct address" do
17      expect(mail.from).to include('noreply@cakeside.com')
18    end
19
20    it "includes their name" do
21      expect(mail.body.encoded).to match(CGI.escapeHTML(user.name))
22    end
23  end
24end