Skip to content

Commit

Permalink
revert address key change
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Dec 8, 2011
1 parent f74017f commit a1e96bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions services/email.rb
@@ -1,5 +1,5 @@
class Service::Email < Service
string :addresses, :secret
string :address, :secret
boolean :send_from_author

def receive_push
Expand Down Expand Up @@ -65,7 +65,7 @@ def receive_push
commit = payload['commits'].last # assume that the last committer is also the pusher

begin
data['addresses'].split(' ').slice(0, 2).each do |address|
data['address'].split(' ').slice(0, 2).each do |address|
message = TMail::Mail.new
message.set_content_type('text', 'plain', {:charset => 'UTF-8'})
message.from = "#{commit['author']['name']} <#{commit['author']['email']}>" if data['send_from_author']
Expand All @@ -88,7 +88,7 @@ def receive_push

def smtp_settings
@smtp_settings ||= begin
args = [ email_config['addresses'], (email_config['port'] || 25).to_i, (email_config['domain'] || 'localhost.localdomain') ]
args = [ email_config['address'], (email_config['port'] || 25).to_i, (email_config['domain'] || 'localhost.localdomain') ]
if email_config['authentication']
args.push email_config['user_name'], email_config['password'], email_config['authentication']
end
Expand Down
16 changes: 8 additions & 8 deletions test/email_test.rb
Expand Up @@ -3,7 +3,7 @@
class EmailTest < Service::TestCase
def test_push
svc = service(
{'addresses' => 'a'},
{'address' => 'a'},
payload)

svc.receive_push
Expand All @@ -15,9 +15,9 @@ def test_push
assert_nil svc.messages.shift
end

def test_multiple_addresses
def test_multiple_address
svc = service(
{'addresses' => ' a b c'},
{'address' => ' a b c'},
payload)

svc.receive_push
Expand All @@ -36,7 +36,7 @@ def test_multiple_addresses

def test_push_from_author
svc = service(
{'addresses' => 'a', 'send_from_author' => '1'},
{'address' => 'a', 'send_from_author' => '1'},
payload)

svc.receive_push
Expand All @@ -50,17 +50,17 @@ def test_push_from_author

def test_smtp_settings
svc = service(
{'addresses' => 'a'},
{'address' => 'a'},
'payload')
svc.email_config = {'addresses' => 'a', 'port' => '1', 'domain' => 'd'}
svc.email_config = {'address' => 'a', 'port' => '1', 'domain' => 'd'}
assert_equal ['a', 1, 'd'], svc.smtp_settings
end

def test_smtp_settings_with_auth
svc = service(
{'addresses' => 'a'},
{'address' => 'a'},
'payload')
svc.email_config = {'addresses' => 'a', 'port' => '1', 'domain' => 'd',
svc.email_config = {'address' => 'a', 'port' => '1', 'domain' => 'd',
'authentication' => 'au', 'user_name' => 'u', 'password' => 'p'}
assert_equal ['a', 1, 'd', 'u', 'p', 'au'], svc.smtp_settings
end
Expand Down

0 comments on commit a1e96bd

Please sign in to comment.