Commit a9390b36

mo khan <mo@mokhan.ca>
2014-01-08 00:46:49
add specs for user mailer.
1 parent 8062667
Changed files (2)
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