Commit a9390b36
Changed files (2)
app
mailers
spec
mailers
app/mailers/user_mailer.rb
@@ -1,5 +1,5 @@
class UserMailer < ActionMailer::Base
- default from: "from@example.com"
+ default from: "noreply@cakeside.com"
def welcome_email(user)
@url = 'https://www.cakeside.com/login'
spec/mailers/user_mailer_spec.rb
@@ -1,4 +1,24 @@
require "spec_helper"
describe UserMailer do
+ context "send welcome email" do
+ let(:user) { build(:user) }
+ let(:mail) { UserMailer.welcome_email(user) }
+
+ it "adds a subject" do
+ mail.subject.should == "Welcome to CakeSide"
+ end
+
+ it "sends to the users email" do
+ mail.to.should include user.email
+ end
+
+ it "should send from the correct address" do
+ mail.from.should include 'noreply@cakeside.com'
+ end
+
+ it "includes their name" do
+ mail.body.encoded.should match(user.name)
+ end
+ end
end