From a7c8d9311fdfba0697af19fcb33f130622d59b49 Mon Sep 17 00:00:00 2001
From: Jonathan Kolyer
Vestibulum mollis enim eu fringilla vulputate. Nam tincidunt, enim eget fringilla blandit, mi neque dictum dolor, non pellentesque libero erat sed massa. Morbi sodales lobortis eros, sed feugiat eros euismod eget. Nulla vulputate lobortis porttitor.
+ +Thanks for using JamKazam!
+ +The JamKazam Team +FOO + include AASM aasm do state :pending, :initial => true @@ -47,6 +59,7 @@ module JamRuby def self.create_with_params(params) obj = self.new params.each { |kk,vv| vv.strip! } + params[:body] = BODY_TEMPLATE if params[:body].empty? obj.update_with_conflict_validation(params) obj end diff --git a/ruby/spec/mailers/batch_mailer_spec.rb b/ruby/spec/mailers/batch_mailer_spec.rb index a1a216607..784279db8 100644 --- a/ruby/spec/mailers/batch_mailer_spec.rb +++ b/ruby/spec/mailers/batch_mailer_spec.rb @@ -3,18 +3,21 @@ require "spec_helper" describe BatchMailer do describe "should send test emails" do - BatchMailer.deliveries.clear - - let (:mail) { BatchMailer.deliveries[0] } + ActionMailer::Base.deliveries.clear batch = FactoryGirl.create(:email_batch) - batch.update_attribute(:test_emails, "jonathan@jamkazam.com") batch.send_test_batch + sleep(3) - it { BatchMailer.deliveries.length.should == 1 } + mail = BatchMailer.deliveries.detect { |dd| dd['to'].to_s.split(',')[0] == batch.test_emails.split(',')[0]} + # let (:mail) { BatchMailer.deliveries[0] } + # it { mail['to'].to_s.split(',')[0].should == batch.test_emails.split(',')[0] } + + it { mail.should_not be_nil } + + # it { BatchMailer.deliveries.length.should == 1 } it { mail['from'].to_s.should == EmailBatch::DEFAULT_SENDER } - it { mail['to'].to_s.split(',')[0].should == batch.test_emails.split(',')[0] } it { mail.subject.should == batch.subject } it { mail.multipart?.should == true } # because we send plain + html