diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-07 13:09:22 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-07 13:09:22 -0700 |
commit | 221211088bc2a0421dc641355017d3ba78b25cc5 (patch) | |
tree | 893ed86433062fb3ef11e9f0e0d8d64ebbf3405e /actionmailer/test | |
parent | 918f7038b3d4d4180a4d1056bb4b7b3f3b85508f (diff) | |
parent | 96f290eac03e1241fc1e57f119eaca72b682c5af (diff) | |
download | rails-221211088bc2a0421dc641355017d3ba78b25cc5.tar.gz rails-221211088bc2a0421dc641355017d3ba78b25cc5.tar.bz2 rails-221211088bc2a0421dc641355017d3ba78b25cc5.zip |
Merge pull request #7869 from Locke23rus/actionmailer_new_hash_syntax
Update actionmailer with new hash syntax.
Just to make clear we don't accept this kind of pull request because it can invalidate a lot of pull requests.
I'm accepting this because Action Mailer has only two open pull requests.
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/asset_host_test.rb | 6 | ||||
-rw-r--r-- | actionmailer/test/base_test.rb | 64 | ||||
-rw-r--r-- | actionmailer/test/delivery_methods_test.rb | 52 | ||||
-rw-r--r-- | actionmailer/test/i18n_with_controller_test.rb | 8 | ||||
-rw-r--r-- | actionmailer/test/mail_helper_test.rb | 16 | ||||
-rw-r--r-- | actionmailer/test/mail_layout_test.rb | 20 | ||||
-rw-r--r-- | actionmailer/test/mailers/base_mailer.rb | 40 | ||||
-rw-r--r-- | actionmailer/test/mailers/proc_mailer.rb | 4 | ||||
-rw-r--r-- | actionmailer/test/test_helper_test.rb | 6 | ||||
-rw-r--r-- | actionmailer/test/url_test.rb | 8 |
10 files changed, 112 insertions, 112 deletions
diff --git a/actionmailer/test/asset_host_test.rb b/actionmailer/test/asset_host_test.rb index 696a9f1174..32ae76a7c5 100644 --- a/actionmailer/test/asset_host_test.rb +++ b/actionmailer/test/asset_host_test.rb @@ -3,9 +3,9 @@ require 'action_controller' class AssetHostMailer < ActionMailer::Base def email_with_asset - mail :to => 'test@localhost', - :subject => 'testing email containing asset path while asset_host is set', - :from => 'tester@example.com' + mail to: 'test@localhost', + subject: 'testing email containing asset path while asset_host is set', + from: 'tester@example.com' end end diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index 17ce8b7072..1cb3ce63fe 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -30,21 +30,21 @@ class BaseTest < ActiveSupport::TestCase end test "mail() with from overwrites the class level default" do - email = BaseMailer.welcome(:from => 'someone@example.com', - :to => 'another@example.org') + email = BaseMailer.welcome(from: 'someone@example.com', + to: 'another@example.org') assert_equal(['someone@example.com'], email.from) assert_equal(['another@example.org'], email.to) end test "mail() with bcc, cc, content_type, charset, mime_version, reply_to and date" do time = Time.now.beginning_of_day.to_datetime - email = BaseMailer.welcome(:bcc => 'bcc@test.lindsaar.net', - :cc => 'cc@test.lindsaar.net', - :content_type => 'multipart/mixed', - :charset => 'iso-8559-1', - :mime_version => '2.0', - :reply_to => 'reply-to@test.lindsaar.net', - :date => time) + email = BaseMailer.welcome(bcc: 'bcc@test.lindsaar.net', + cc: 'cc@test.lindsaar.net', + content_type: 'multipart/mixed', + charset: 'iso-8559-1', + mime_version: '2.0', + reply_to: 'reply-to@test.lindsaar.net', + date: time) assert_equal(['bcc@test.lindsaar.net'], email.bcc) assert_equal(['cc@test.lindsaar.net'], email.cc) assert_equal('multipart/mixed; charset=iso-8559-1', email.content_type) @@ -60,7 +60,7 @@ class BaseTest < ActiveSupport::TestCase end test "can pass in :body to the mail method hash" do - email = BaseMailer.welcome(:body => "Hello there") + email = BaseMailer.welcome(body: "Hello there") assert_equal("text/plain", email.mime_type) assert_equal("Hello there", email.body.encoded) end @@ -142,7 +142,7 @@ class BaseTest < ActiveSupport::TestCase end test "adds the given :body as part" do - email = BaseMailer.attachment_with_content(:body => "I'm the eggman") + email = BaseMailer.attachment_with_content(body: "I'm the eggman") assert_equal(2, email.parts.length) assert_equal("multipart/mixed", email.mime_type) assert_equal("text/plain", email.parts[0].mime_type) @@ -165,31 +165,31 @@ class BaseTest < ActiveSupport::TestCase # Defaults values test "uses default charset from class" do - with_default BaseMailer, :charset => "US-ASCII" do + with_default BaseMailer, charset: "US-ASCII" do email = BaseMailer.welcome assert_equal("US-ASCII", email.charset) - email = BaseMailer.welcome(:charset => "iso-8559-1") + email = BaseMailer.welcome(charset: "iso-8559-1") assert_equal("iso-8559-1", email.charset) end end test "uses default content type from class" do - with_default BaseMailer, :content_type => "text/html" do + with_default BaseMailer, content_type: "text/html" do email = BaseMailer.welcome assert_equal("text/html", email.mime_type) - email = BaseMailer.welcome(:content_type => "text/plain") + email = BaseMailer.welcome(content_type: "text/plain") assert_equal("text/plain", email.mime_type) end end test "uses default mime version from class" do - with_default BaseMailer, :mime_version => "2.0" do + with_default BaseMailer, mime_version: "2.0" do email = BaseMailer.welcome assert_equal("2.0", email.mime_version) - email = BaseMailer.welcome(:mime_version => "1.0") + email = BaseMailer.welcome(mime_version: "1.0") assert_equal("1.0", email.mime_version) end end @@ -202,17 +202,17 @@ class BaseTest < ActiveSupport::TestCase end test "subject gets default from I18n" do - BaseMailer.default :subject => nil - email = BaseMailer.welcome(:subject => nil) + BaseMailer.default subject: nil + email = BaseMailer.welcome(subject: nil) assert_equal "Welcome", email.subject - I18n.backend.store_translations('en', :base_mailer => {:welcome => {:subject => "New Subject!"}}) - email = BaseMailer.welcome(:subject => nil) + I18n.backend.store_translations('en', base_mailer: {welcome: {subject: "New Subject!"}}) + email = BaseMailer.welcome(subject: nil) assert_equal "New Subject!", email.subject end test "translations are scoped properly" do - I18n.backend.store_translations('en', :base_mailer => {:email_with_translations => {:greet_user => "Hello %{name}!"}}) + I18n.backend.store_translations('en', base_mailer: {email_with_translations: {greet_user: "Hello %{name}!"}}) email = BaseMailer.email_with_translations assert_equal 'Hello lifo!', email.body.encoded end @@ -230,19 +230,19 @@ class BaseTest < ActiveSupport::TestCase test "implicit multipart with sort order" do order = ["text/html", "text/plain"] - with_default BaseMailer, :parts_order => order do + with_default BaseMailer, parts_order: order do email = BaseMailer.implicit_multipart assert_equal("text/html", email.parts[0].mime_type) assert_equal("text/plain", email.parts[1].mime_type) - email = BaseMailer.implicit_multipart(:parts_order => order.reverse) + email = BaseMailer.implicit_multipart(parts_order: order.reverse) assert_equal("text/plain", email.parts[0].mime_type) assert_equal("text/html", email.parts[1].mime_type) end end test "implicit multipart with attachments creates nested parts" do - email = BaseMailer.implicit_multipart(:attachments => true) + email = BaseMailer.implicit_multipart(attachments: true) assert_equal("application/pdf", email.parts[0].mime_type) assert_equal("multipart/alternative", email.parts[1].mime_type) assert_equal("text/plain", email.parts[1].parts[0].mime_type) @@ -253,8 +253,8 @@ class BaseTest < ActiveSupport::TestCase test "implicit multipart with attachments and sort order" do order = ["text/html", "text/plain"] - with_default BaseMailer, :parts_order => order do - email = BaseMailer.implicit_multipart(:attachments => true) + with_default BaseMailer, parts_order: order do + email = BaseMailer.implicit_multipart(attachments: true) assert_equal("application/pdf", email.parts[0].mime_type) assert_equal("multipart/alternative", email.parts[1].mime_type) assert_equal("text/plain", email.parts[1].parts[1].mime_type) @@ -273,7 +273,7 @@ class BaseTest < ActiveSupport::TestCase end test "implicit multipart with other locale" do - swap I18n, :locale => :pl do + swap I18n, locale: :pl do email = BaseMailer.implicit_with_locale assert_equal(2, email.parts.size) assert_equal("multipart/alternative", email.mime_type) @@ -324,19 +324,19 @@ class BaseTest < ActiveSupport::TestCase test "explicit multipart does not sort order" do order = ["text/html", "text/plain"] - with_default BaseMailer, :parts_order => order do + with_default BaseMailer, parts_order: order do email = BaseMailer.explicit_multipart assert_equal("text/plain", email.parts[0].mime_type) assert_equal("text/html", email.parts[1].mime_type) - email = BaseMailer.explicit_multipart(:parts_order => order.reverse) + email = BaseMailer.explicit_multipart(parts_order: order.reverse) assert_equal("text/plain", email.parts[0].mime_type) assert_equal("text/html", email.parts[1].mime_type) end end test "explicit multipart with attachments creates nested parts" do - email = BaseMailer.explicit_multipart(:attachments => true) + email = BaseMailer.explicit_multipart(attachments: true) assert_equal("application/pdf", email.parts[0].mime_type) assert_equal("multipart/alternative", email.parts[1].mime_type) assert_equal("text/plain", email.parts[1].parts[0].mime_type) @@ -651,7 +651,7 @@ class BaseTest < ActiveSupport::TestCase test "default_from can be set" do class DefaultFromMailer < ActionMailer::Base - default :to => 'system@test.lindsaar.net' + default to: 'system@test.lindsaar.net' self.default_options = {from: "robert.pankowecki@gmail.com"} def welcome diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb index 7109f23e4c..61a037ea18 100644 --- a/actionmailer/test/delivery_methods_test.rb +++ b/actionmailer/test/delivery_methods_test.rb @@ -22,24 +22,24 @@ end class DefaultsDeliveryMethodsTest < ActiveSupport::TestCase test "default smtp settings" do - settings = { :address => "localhost", - :port => 25, - :domain => 'localhost.localdomain', - :user_name => nil, - :password => nil, - :authentication => nil, - :enable_starttls_auto => true } + settings = { address: "localhost", + port: 25, + domain: 'localhost.localdomain', + user_name: nil, + password: nil, + authentication: nil, + enable_starttls_auto: true } assert_equal settings, ActionMailer::Base.smtp_settings end test "default file delivery settings" do - settings = {:location => "#{Dir.tmpdir}/mails"} + settings = {location: "#{Dir.tmpdir}/mails"} assert_equal settings, ActionMailer::Base.file_settings end test "default sendmail settings" do - settings = {:location => '/usr/sbin/sendmail', - :arguments => '-i -t'} + settings = {location: '/usr/sbin/sendmail', + arguments: '-i -t'} assert_equal settings, ActionMailer::Base.sendmail_settings end end @@ -63,8 +63,8 @@ class CustomDeliveryMethodsTest < ActiveSupport::TestCase end test "allow to customize custom settings" do - ActionMailer::Base.custom_settings = { :foo => :bar } - assert_equal Hash[:foo => :bar], ActionMailer::Base.custom_settings + ActionMailer::Base.custom_settings = { foo: :bar } + assert_equal Hash[foo: :bar], ActionMailer::Base.custom_settings end test "respond to custom settings" do @@ -82,8 +82,8 @@ end class MailDeliveryTest < ActiveSupport::TestCase class DeliveryMailer < ActionMailer::Base DEFAULT_HEADERS = { - :to => 'mikel@test.lindsaar.net', - :from => 'jose@test.plataformatec.com' + to: 'mikel@test.lindsaar.net', + from: 'jose@test.plataformatec.com' } def welcome(hash={}) @@ -110,7 +110,7 @@ class MailDeliveryTest < ActiveSupport::TestCase test "delivery method can be customized per instance" do email = DeliveryMailer.welcome.deliver assert_instance_of Mail::SMTP, email.delivery_method - email = DeliveryMailer.welcome(:delivery_method => :test).deliver + email = DeliveryMailer.welcome(delivery_method: :test).deliver assert_instance_of Mail::TestMailer, email.delivery_method end @@ -125,7 +125,7 @@ class MailDeliveryTest < ActiveSupport::TestCase test "delivery method options default to class level options" do default_options = {a: "b"} ActionMailer::Base.add_delivery_method :optioned, MyOptionedDelivery, default_options - mail_instance = DeliveryMailer.welcome(:delivery_method => :optioned) + mail_instance = DeliveryMailer.welcome(delivery_method: :optioned) assert_equal default_options, mail_instance.delivery_method.options end @@ -133,21 +133,21 @@ class MailDeliveryTest < ActiveSupport::TestCase default_options = {a: "b"} ActionMailer::Base.add_delivery_method :optioned, MyOptionedDelivery, default_options overridden_options = {a: "a"} - mail_instance = DeliveryMailer.welcome(:delivery_method => :optioned, :delivery_method_options => overridden_options) + mail_instance = DeliveryMailer.welcome(delivery_method: :optioned, delivery_method_options: overridden_options) assert_equal overridden_options, mail_instance.delivery_method.options end test "default delivery options can be overridden per mail instance" do - settings = { :address => "localhost", - :port => 25, - :domain => 'localhost.localdomain', - :user_name => nil, - :password => nil, - :authentication => nil, - :enable_starttls_auto => true } + settings = { address: "localhost", + port: 25, + domain: 'localhost.localdomain', + user_name: nil, + password: nil, + authentication: nil, + enable_starttls_auto: true } assert_equal settings, ActionMailer::Base.smtp_settings - overridden_options = {user_name: "overridden", :password => "somethingobtuse"} - mail_instance = DeliveryMailer.welcome(:delivery_method_options => overridden_options) + overridden_options = {user_name: "overridden", password: "somethingobtuse"} + mail_instance = DeliveryMailer.welcome(delivery_method_options: overridden_options) delivery_method_instance = mail_instance.delivery_method assert_equal "overridden", delivery_method_instance.settings[:user_name] assert_equal "somethingobtuse", delivery_method_instance.settings[:password] diff --git a/actionmailer/test/i18n_with_controller_test.rb b/actionmailer/test/i18n_with_controller_test.rb index 68ed86e0d4..a3e93c9c31 100644 --- a/actionmailer/test/i18n_with_controller_test.rb +++ b/actionmailer/test/i18n_with_controller_test.rb @@ -9,15 +9,15 @@ class I18nTestMailer < ActionMailer::Base def mail_with_i18n_subject(recipient) @recipient = recipient I18n.locale = :de - mail(:to => recipient, :subject => "#{I18n.t :email_subject} #{recipient}", - :from => "system@loudthinking.com", :date => Time.local(2004, 12, 12)) + mail(to: recipient, subject: "#{I18n.t :email_subject} #{recipient}", + from: "system@loudthinking.com", date: Time.local(2004, 12, 12)) end end class TestController < ActionController::Base def send_mail I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver - render :text => 'Mail sent' + render text: 'Mail sent' end end @@ -32,7 +32,7 @@ class ActionMailerI18nWithControllerTest < ActionDispatch::IntegrationTest end def setup - I18n.backend.store_translations('de', :email_subject => '[Signed up] Welcome') + I18n.backend.store_translations('de', email_subject: '[Signed up] Welcome') end def teardown diff --git a/actionmailer/test/mail_helper_test.rb b/actionmailer/test/mail_helper_test.rb index d8a73e6c46..24ccaab8df 100644 --- a/actionmailer/test/mail_helper_test.rb +++ b/actionmailer/test/mail_helper_test.rb @@ -10,7 +10,7 @@ class HelperMailer < ActionMailer::Base "it off!" mail_with_defaults do |format| - format.html { render(:inline => "<%= block_format @text %>") } + format.html { render(inline: "<%= block_format @text %>") } end end @@ -18,7 +18,7 @@ class HelperMailer < ActionMailer::Base @text = "But soft! What light through yonder window breaks?" mail_with_defaults do |format| - format.html { render(:inline => "<%= format_paragraph @text, 15, 1 %>") } + format.html { render(inline: "<%= format_paragraph @text, 15, 1 %>") } end end @@ -26,19 +26,19 @@ class HelperMailer < ActionMailer::Base @text = "Antidisestablishmentarianism is very long." mail_with_defaults do |format| - format.html { render(:inline => "<%= format_paragraph @text, 10, 1 %>") } + format.html { render(inline: "<%= format_paragraph @text, 10, 1 %>") } end end def use_mailer mail_with_defaults do |format| - format.html { render(:inline => "<%= mailer.message.subject %>") } + format.html { render(inline: "<%= mailer.message.subject %>") } end end def use_message mail_with_defaults do |format| - format.html { render(:inline => "<%= message.subject %>") } + format.html { render(inline: "<%= message.subject %>") } end end @@ -55,15 +55,15 @@ The second TEXT mail_with_defaults do |format| - format.html { render(:inline => "<%= block_format @text %>") } + format.html { render(inline: "<%= block_format @text %>") } end end protected def mail_with_defaults(&block) - mail(:to => "test@localhost", :from => "tester@example.com", - :subject => "using helpers", &block) + mail(to: "test@localhost", from: "tester@example.com", + subject: "using helpers", &block) end end diff --git a/actionmailer/test/mail_layout_test.rb b/actionmailer/test/mail_layout_test.rb index 71e93c29f1..7f959282cb 100644 --- a/actionmailer/test/mail_layout_test.rb +++ b/actionmailer/test/mail_layout_test.rb @@ -1,9 +1,9 @@ require 'abstract_unit' class AutoLayoutMailer < ActionMailer::Base - default :to => 'test@localhost', - :subject => "You have a mail", - :from => "tester@example.com" + default to: 'test@localhost', + subject: "You have a mail", + from: "tester@example.com" def hello mail() @@ -11,16 +11,16 @@ class AutoLayoutMailer < ActionMailer::Base def spam @world = "Earth" - mail(:body => render(:inline => "Hello, <%= @world %>", :layout => 'spam')) + mail(body: render(inline: "Hello, <%= @world %>", layout: 'spam')) end def nolayout @world = "Earth" - mail(:body => render(:inline => "Hello, <%= @world %>", :layout => false)) + mail(body: render(inline: "Hello, <%= @world %>", layout: false)) end def multipart(type = nil) - mail(:content_type => type) do |format| + mail(content_type: type) do |format| format.text { render } format.html { render } end @@ -28,11 +28,11 @@ class AutoLayoutMailer < ActionMailer::Base end class ExplicitLayoutMailer < ActionMailer::Base - layout 'spam', :except => [:logout] + layout 'spam', except: [:logout] - default :to => 'test@localhost', - :subject => "You have a mail", - :from => "tester@example.com" + default to: 'test@localhost', + subject: "You have a mail", + from: "tester@example.com" def signup mail() diff --git a/actionmailer/test/mailers/base_mailer.rb b/actionmailer/test/mailers/base_mailer.rb index e55d72fdb4..f25d9b9aff 100644 --- a/actionmailer/test/mailers/base_mailer.rb +++ b/actionmailer/test/mailers/base_mailer.rb @@ -1,13 +1,13 @@ class BaseMailer < ActionMailer::Base self.mailer_name = "base_mailer" - default :to => 'system@test.lindsaar.net', - :from => 'jose@test.plataformatec.com', - :reply_to => 'mikel@test.lindsaar.net' + default to: 'system@test.lindsaar.net', + from: 'jose@test.plataformatec.com', + reply_to: 'mikel@test.lindsaar.net' def welcome(hash = {}) headers['X-SPAM'] = "Not SPAM" - mail({:subject => "The first email on new API!"}.merge!(hash)) + mail({subject: "The first email on new API!"}.merge!(hash)) end def welcome_with_headers(hash = {}) @@ -16,7 +16,7 @@ class BaseMailer < ActionMailer::Base end def welcome_from_another_path(path) - mail(:template_name => "welcome", :template_path => path) + mail(template_name: "welcome", template_path: path) end def html_only(hash = {}) @@ -38,15 +38,15 @@ class BaseMailer < ActionMailer::Base end def attachment_with_hash - attachments['invoice.jpg'] = { :data => "\312\213\254\232)b", - :mime_type => "image/x-jpg", - :transfer_encoding => "base64" } + attachments['invoice.jpg'] = { data: "\312\213\254\232)b", + mime_type: "image/x-jpg", + transfer_encoding: "base64" } mail end def attachment_with_hash_default_encoding - attachments['invoice.jpg'] = { :data => "\312\213\254\232)b", - :mime_type => "image/x-jpg" } + attachments['invoice.jpg'] = { data: "\312\213\254\232)b", + mime_type: "image/x-jpg" } mail end @@ -62,8 +62,8 @@ class BaseMailer < ActionMailer::Base def explicit_multipart(hash = {}) attachments['invoice.pdf'] = 'This is test File content' if hash.delete(:attachments) mail(hash) do |format| - format.text { render :text => "TEXT Explicit Multipart" } - format.html { render :text => "HTML Explicit Multipart" } + format.text { render text: "TEXT Explicit Multipart" } + format.html { render text: "HTML Explicit Multipart" } end end @@ -76,13 +76,13 @@ class BaseMailer < ActionMailer::Base def explicit_multipart_with_any(hash = {}) mail(hash) do |format| - format.any(:text, :html){ render :text => "Format with any!" } + format.any(:text, :html){ render text: "Format with any!" } end end def explicit_multipart_with_options(include_html = false) mail do |format| - format.text(:content_transfer_encoding => "base64"){ render "welcome" } + format.text(content_transfer_encoding: "base64"){ render "welcome" } format.html{ render "welcome" } if include_html end end @@ -95,24 +95,24 @@ class BaseMailer < ActionMailer::Base end def implicit_different_template(template_name='') - mail(:template_name => template_name) + mail(template_name: template_name) end def explicit_different_template(template_name='') mail do |format| - format.text { render :template => "#{mailer_name}/#{template_name}" } - format.html { render :template => "#{mailer_name}/#{template_name}" } + format.text { render template: "#{mailer_name}/#{template_name}" } + format.html { render template: "#{mailer_name}/#{template_name}" } end end def different_layout(layout_name='') mail do |format| - format.text { render :layout => layout_name } - format.html { render :layout => layout_name } + format.text { render layout: layout_name } + format.html { render layout: layout_name } end end def email_with_translations - mail :body => render("email_with_translations", :formats => [:html]) + mail body: render("email_with_translations", formats: [:html]) end end diff --git a/actionmailer/test/mailers/proc_mailer.rb b/actionmailer/test/mailers/proc_mailer.rb index 43916e1421..733633b575 100644 --- a/actionmailer/test/mailers/proc_mailer.rb +++ b/actionmailer/test/mailers/proc_mailer.rb @@ -1,7 +1,7 @@ class ProcMailer < ActionMailer::Base - default :to => 'system@test.lindsaar.net', + default to: 'system@test.lindsaar.net', 'X-Proc-Method' => Proc.new { Time.now.to_i.to_s }, - :subject => Proc.new { give_a_greeting } + subject: Proc.new { give_a_greeting } def welcome mail diff --git a/actionmailer/test/test_helper_test.rb b/actionmailer/test/test_helper_test.rb index dd62164176..7c7f0b6fdc 100644 --- a/actionmailer/test/test_helper_test.rb +++ b/actionmailer/test/test_helper_test.rb @@ -3,9 +3,9 @@ require 'abstract_unit' class TestHelperMailer < ActionMailer::Base def test @world = "Earth" - mail :body => render(:inline => "Hello, <%= @world %>"), - :to => "test@example.com", - :from => "tester@example.com" + mail body: render(inline: "Hello, <%= @world %>"), + to: "test@example.com", + from: "tester@example.com" end end diff --git a/actionmailer/test/url_test.rb b/actionmailer/test/url_test.rb index 2ea1723434..dcd80f46b5 100644 --- a/actionmailer/test/url_test.rb +++ b/actionmailer/test/url_test.rb @@ -19,9 +19,9 @@ class UrlTestMailer < ActionMailer::Base def signed_up_with_url(recipient) @recipient = recipient - @welcome_url = url_for :host => "example.com", :controller => "welcome", :action => "greeting" - mail(:to => recipient, :subject => "[Signed up] Welcome #{recipient}", - :from => "system@loudthinking.com", :date => Time.local(2004, 12, 12)) + @welcome_url = url_for host: "example.com", controller: "welcome", action: "greeting" + mail(to: recipient, subject: "[Signed up] Welcome #{recipient}", + from: "system@loudthinking.com", date: Time.local(2004, 12, 12)) end end @@ -58,7 +58,7 @@ class ActionMailerUrlTest < ActionMailer::TestCase AppRoutes.draw do get ':controller(/:action(/:id))' - get '/welcome' => "foo#bar", :as => "welcome" + get '/welcome' => "foo#bar", as: "welcome" end expected = new_mail |