Commit f68d177

mo khan <mo@mokhan.ca>
2015-01-21 05:24:41
add mailer preview.
1 parent 3dce59c
Changed files (4)
config/environments/development.rb
@@ -15,6 +15,7 @@ Rails.application.configure do
 
   # Don't care if the mailer can't send.
   config.action_mailer.raise_delivery_errors = false
+  config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews"
 
   # Print deprecation notices to the Rails logger.
   config.active_support.deprecation = :log
spec/controllers/registrations_controller_spec.rb
@@ -47,7 +47,12 @@ describe RegistrationsController do
 
     context "when the parameters provided are invalid" do
       before :each do
-        post :create, user: { username: "", password: password, email: email, terms_and_conditions: true }
+        post :create, user: {
+          username: "",
+          password: password,
+          email: email,
+          terms_and_conditions: true
+        }
       end
 
       it "adds an error to the flash for missing usernames" do
spec/mailers/previews/user_mailer_preview.rb
@@ -0,0 +1,5 @@
+class UserMailerPreview < ActionMailer::Preview
+  def registration_email
+    UserMailer.registration_email(User.last)
+  end
+end
spec/mailers/user_mailer_spec.rb
@@ -18,4 +18,3 @@ RSpec.describe UserMailer, type: :mailer do
     end
   end
 end
-