diff --git a/services/email.rb b/services/email.rb index 94f5489ac..de994d18b 100644 --- a/services/email.rb +++ b/services/email.rb @@ -1,5 +1,5 @@ class Service::Email < Service - string :addresses, :secret + string :address, :secret boolean :send_from_author def receive_push @@ -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'] @@ -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 diff --git a/test/email_test.rb b/test/email_test.rb index 790336991..4e29d64e6 100644 --- a/test/email_test.rb +++ b/test/email_test.rb @@ -3,7 +3,7 @@ class EmailTest < Service::TestCase def test_push svc = service( - {'addresses' => 'a'}, + {'address' => 'a'}, payload) svc.receive_push @@ -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 @@ -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 @@ -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