aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/base_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/test/base_test.rb')
-rw-r--r--actionmailer/test/base_test.rb64
1 files changed, 32 insertions, 32 deletions
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