Sha256: 400ea859381c83bbff91b601b167288bc29acd60a5c3b15afe0904256f75a432
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
require "spec_helper" require "multi_notifier/middlewares/mail" describe MultiNotifier::Middlewares::Mail do context "validations" do [:delivery, :from, :to, :subject, :text_body].each do |field| it "#{field} can't be blank" do instance = described_class.new instance.should be_invalid instance.errors[field].should include("can't be blank") end end it "delivery method can't be blank" do instance = described_class.new(:delivery => { :foo => :bar }) instance.should be_invalid instance.errors[:delivery].should include("method can't be blank") end end context "notify" do it "sends email" do mail = MultiNotifier::Middlewares::Mail.new mail.delivery = { :method => :test } mail.from = "from@owenou.com" mail.to = "to@owenou.com" mail.subject = "subject" mail.text_body = "text body" mail.html_body = "html body" mailer = mail.notify! mailer.from.should == [mail.from] mailer.to.should == [mail.to] mailer.subject.should == mail.subject mailer.body.encoded.should include(mail.text_body) mailer.body.encoded.should include(mail.html_body) end end end
Version data entries
3 entries across 3 versions & 1 rubygems