Sha256: 50edd2d6b8f0e58544f16e37ad214e159f5c70f6456ec4f2994da571abb64000
Contents?: true
Size: 1.88 KB
Versions: 1
Compression:
Stored size: 1.88 KB
Contents
require 'spec_helper' describe ContactUs::ContactMailer do describe "#contact_email" do before do ContactUs.mailer_to = "contact@please-change-me.com" @contact = ContactUs::Contact.new(:email => 'test@email.com', :message => 'Thanks!') end it "should render successfully" do lambda { ContactUs::ContactMailer.contact_email(@contact) }.should_not raise_error end it "should use the ContactUs.mailer_from setting when it is set" do ContactUs.mailer_from = "contact@please-change-me.com" @mailer = ContactUs::ContactMailer.contact_email(@contact) @mailer.from.should eql([ContactUs.mailer_from]) ContactUs.mailer_from = nil end describe "rendered without error" do before do @mailer = ContactUs::ContactMailer.contact_email(@contact) end it "should have the initializers to address" do @mailer.to.should eql([ContactUs.mailer_to]) end it "should use the users email in the from field when ContactUs.mailer_from is not set" do @mailer.from.should eql([@contact.email]) end it "should use the users email in the reply_to field" do @mailer.reply_to.should eql([@contact.email]) end it "should have users email in the subject line" do @mailer.subject.should eql("Contact Us message from #{@contact.email}") end it "should have the message in the body" do @mailer.body.should match("<p>Thanks!</p>") end it "should deliver successfully" do lambda { ContactUs::ContactMailer.contact_email(@contact).deliver_now }.should_not raise_error end describe "and delivered" do it "should be added to the delivery queue" do lambda { ContactUs::ContactMailer.contact_email(@contact).deliver_now }.should change(ActionMailer::Base.deliveries,:size).by(1) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
contact_us-1.0.0 | spec/mailers/contact_us/contact_mailer_spec.rb |