Skip to content

Commit

Permalink
fix issue with ActionMailer 2.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cpjolicoeur committed Aug 4, 2009
1 parent 40b75c0 commit abf21d2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/cerberus/config.example.yml
Expand Up @@ -7,6 +7,7 @@ publisher:
authentication: plain
user_name: someuser
password: somepassword
sender: cerberus@example.com
# on_event: all
# jabber:
# jid: somemailbox@gmail.com/cerberus
Expand Down
8 changes: 4 additions & 4 deletions lib/cerberus/publisher/mail.rb
Expand Up @@ -2,8 +2,8 @@
require 'action_mailer'
require 'cerberus/publisher/base'

if RUBY_VERSION > '1.8.2'
#This hack works only on 1.8.4
if RUBY_VERSION =~ /1\.8\.\d/
# This hack works only on 1.8.x
require 'cerberus/publisher/netsmtp_tls_fix'
end

Expand All @@ -30,8 +30,8 @@ class ActionMailerPublisher < ActionMailer::Base
def message(state, manager, options)
@subject, @body = Cerberus::Publisher::Base.formatted_message(state, manager, options)
@recipients, @sent_on = options[:publisher, :mail, :recipients], Time.now
@from = options[:publisher, :mail, :sender] || "'Cerberus' <cerberus@example.com>"
@from = options[:publisher, :mail, :sender] || 'cerberus@example.com'
raise "Please specify recipient addresses for application '#{options[:application_name]}'" unless @recipients
end
end
end
end
4 changes: 2 additions & 2 deletions test/mail_publisher_test.rb
Expand Up @@ -11,7 +11,7 @@ def setup

def test_publisher
options = Cerberus::Config.new(nil, :publisher => {
:mail => {:recipients => 'anatol.pomozov@hello.com', :sender => 'haha', :delivery_method => 'test'}},
:mail => {:recipients => 'anatol.pomozov@hello.com', :sender => "cerberus@example.com", :delivery_method => 'test'}},
:application_name => 'MyApp')
build = DummyManager.new('last message', 'this is output', 1232, 'anatol')

Expand All @@ -20,7 +20,7 @@ def test_publisher
mails = ActionMailer::Base.deliveries
assert_equal 1, mails.size
mail = mails[0]
assert_equal 'haha', mail.from_addrs[0].address
assert_equal 'cerberus@example.com', mail.from_addrs[0].address
assert_equal '[MyApp] Cerberus set up for project (1232)', mail.subject
end
end

0 comments on commit abf21d2

Please sign in to comment.