Sha256: bd06fc930e6df74ebe63ef7409d2f44df9203ebe15ce3db14698058016cf2926
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require "mail/spec_helper" describe "MailController" do with_environment with_mail with_view_path "#{spec_dir}/views" before :all do MailController = Rad::MailController end after :all do remove_constants %w( MailController ExplicitBodySpec BodyTemplateSpec ) end def common_letter {from: "john@mail.com", to: "ben@mail.com", subject: "hi there"}.to_openobject end describe "building letter" do it "shouldn't render view if body explicitly specified" do class ::ExplicitBodySpec inherit MailController def signup model @from, @to, @subject = model.from, model.to, model.subject @body = "Hello Ben, signup notification." end end letter = ExplicitBodySpec.signup(common_letter.merge(body: 'Hello Ben, signup notification.')) letter.to_h.to_openobject.should == common_letter.merge(body: 'Hello Ben, signup notification.') end it "should use template for body" do class ::BodyTemplateSpec inherit MailController def signup model, name @name = name @from, @to, @subject = model.from, model.to, model.subject end end letter = BodyTemplateSpec.signup(common_letter, "Ben") letter.to_h.to_openobject.should == common_letter.merge(body: 'Hello Ben, signup notification.') end end it "delivering" do letter = Rad::Letter.new common_letter.merge(body: "some text") letter.deliver letter.deliver sent_letters.should == [letter, letter] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rad_core-0.0.13 | spec/mail/mail_controller_spec.rb |