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

RSpec.describe UserMailer, type: :mailer do
  describe "registration email" do
    let(:user) { double User, username: "blah", email:"blah@example.com" }
    let(:mail) { UserMailer.registration_email(user) }
    it "renders the subject" do
      expect(mail.subject).to eql("Welcome to Strong Lifters.")
    end
    it "renders the recipient email" do
      expect(mail.to).to eql([user.email])
    end
    it "renders the sender email" do
      expect(mail.from).to eql(["from@example.com"])
    end
    it "assigns a username" do
      expect(mail.body.encoded).to match(user.username)
    end
  end
end