aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-08-16 04:30:11 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-08-16 04:30:11 -0300
commit55f9b8129a50206513264824abb44088230793c2 (patch)
treeff2f01cabfc7e74b0bd831c2272a5517e4e81e99 /actionmailer
parentd0bdd74d7f6fae3d69b3681d5bc2d5ef6f55a0f8 (diff)
downloadrails-55f9b8129a50206513264824abb44088230793c2.tar.gz
rails-55f9b8129a50206513264824abb44088230793c2.tar.bz2
rails-55f9b8129a50206513264824abb44088230793c2.zip
Add three new rubocop rules
Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/lib/action_mailer/inline_preview_interceptor.rb2
-rw-r--r--actionmailer/lib/action_mailer/preview.rb6
-rw-r--r--actionmailer/test/base_test.rb14
-rw-r--r--actionmailer/test/caching_test.rb4
-rw-r--r--actionmailer/test/delivery_methods_test.rb10
-rw-r--r--actionmailer/test/mailers/base_mailer.rb8
-rw-r--r--actionmailer/test/url_test.rb2
7 files changed, 23 insertions, 23 deletions
diff --git a/actionmailer/lib/action_mailer/inline_preview_interceptor.rb b/actionmailer/lib/action_mailer/inline_preview_interceptor.rb
index fd9a7bce15..b7318f0092 100644
--- a/actionmailer/lib/action_mailer/inline_preview_interceptor.rb
+++ b/actionmailer/lib/action_mailer/inline_preview_interceptor.rb
@@ -55,7 +55,7 @@ module ActionMailer
end
def find_part(cid)
- message.all_parts.find{ |p| p.attachment? && p.cid == cid }
+ message.all_parts.find { |p| p.attachment? && p.cid == cid }
end
end
end
diff --git a/actionmailer/lib/action_mailer/preview.rb b/actionmailer/lib/action_mailer/preview.rb
index 7612cddf22..d88ca7ace4 100644
--- a/actionmailer/lib/action_mailer/preview.rb
+++ b/actionmailer/lib/action_mailer/preview.rb
@@ -80,12 +80,12 @@ module ActionMailer
# Returns true if the preview exists.
def exists?(preview)
- all.any?{ |p| p.preview_name == preview }
+ all.any? { |p| p.preview_name == preview }
end
# Find a mailer preview by its underscored class name.
def find(preview)
- all.find{ |p| p.preview_name == preview }
+ all.find { |p| p.preview_name == preview }
end
# Returns the underscored name of the mailer preview without the suffix.
@@ -96,7 +96,7 @@ module ActionMailer
protected
def load_previews #:nodoc:
if preview_path
- Dir["#{preview_path}/**/*_preview.rb"].each{ |file| require_dependency file }
+ Dir["#{preview_path}/**/*_preview.rb"].each { |file| require_dependency file }
end
end
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 8152f28663..3bca69890d 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -87,7 +87,7 @@ class BaseTest < ActiveSupport::TestCase
end
test "can pass random headers in as a hash to mail" do
- hash = {"X-Special-Domain-Specific-Header" => "SecretValue",
+ hash = { "X-Special-Domain-Specific-Header" => "SecretValue",
"In-Reply-To" => "1234@mikel.me.com" }
mail = BaseMailer.welcome(hash)
assert_equal("SecretValue", mail["X-Special-Domain-Specific-Header"].decoded)
@@ -95,7 +95,7 @@ class BaseTest < ActiveSupport::TestCase
end
test "can pass random headers in as a hash to headers" do
- hash = {"X-Special-Domain-Specific-Header" => "SecretValue",
+ hash = { "X-Special-Domain-Specific-Header" => "SecretValue",
"In-Reply-To" => "1234@mikel.me.com" }
mail = BaseMailer.welcome_with_headers(hash)
assert_equal("SecretValue", mail["X-Special-Domain-Specific-Header"].decoded)
@@ -215,7 +215,7 @@ class BaseTest < ActiveSupport::TestCase
email = BaseMailer.welcome(subject: nil)
assert_equal "Welcome", email.subject
- with_translation "en", base_mailer: {welcome: {subject: "New Subject!"}} do
+ with_translation "en", base_mailer: { welcome: { subject: "New Subject!" } } do
email = BaseMailer.welcome(subject: nil)
assert_equal "New Subject!", email.subject
end
@@ -223,14 +223,14 @@ class BaseTest < ActiveSupport::TestCase
end
test "default subject can have interpolations" do
- with_translation "en", base_mailer: {with_subject_interpolations: {subject: "Will the real %{rapper_or_impersonator} please stand up?"}} do
+ with_translation "en", base_mailer: { with_subject_interpolations: { subject: "Will the real %{rapper_or_impersonator} please stand up?" } } do
email = BaseMailer.with_subject_interpolations
assert_equal "Will the real Slim Shady please stand up?", email.subject
end
end
test "translations are scoped properly" do
- with_translation "en", base_mailer: {email_with_translations: {greet_user: "Hello %{name}!"}} do
+ with_translation "en", base_mailer: { email_with_translations: { greet_user: "Hello %{name}!" } } do
email = BaseMailer.email_with_translations
assert_equal "Hello lifo!", email.body.encoded
end
@@ -271,7 +271,7 @@ class BaseTest < ActiveSupport::TestCase
assert_nothing_raised { mail.message }
assert_equal ["image/jpeg; filename=controller_attachments.jpg",
- "image/jpeg; filename=attachments.jpg"], mail.attachments.inline.map {|a| a["Content-Type"].to_s }
+ "image/jpeg; filename=attachments.jpg"], mail.attachments.inline.map { |a| a["Content-Type"].to_s }
end
test "accessing attachments works after mail was called" do
@@ -798,7 +798,7 @@ class BaseTest < ActiveSupport::TestCase
test "default_from can be set" do
class DefaultFromMailer < ActionMailer::Base
default to: "system@test.lindsaar.net"
- self.default_options = {from: "robert.pankowecki@gmail.com"}
+ self.default_options = { from: "robert.pankowecki@gmail.com" }
def welcome
mail(subject: "subject", body: "hello world")
diff --git a/actionmailer/test/caching_test.rb b/actionmailer/test/caching_test.rb
index d7e21d4c8e..cff49c8894 100644
--- a/actionmailer/test/caching_test.rb
+++ b/actionmailer/test/caching_test.rb
@@ -226,7 +226,7 @@ class CacheHelperOutputBufferTest < BaseCachingTest
cache_helper.stub :output_buffer, output_buffer do
assert_called_with cache_helper, :output_buffer=, [output_buffer.class.new(output_buffer)] do
assert_nothing_raised do
- cache_helper.send :fragment_for, "Test fragment name", "Test fragment", &Proc.new{ nil }
+ cache_helper.send :fragment_for, "Test fragment name", "Test fragment", &Proc.new { nil }
end
end
end
@@ -247,7 +247,7 @@ class CacheHelperOutputBufferTest < BaseCachingTest
cache_helper.stub :output_buffer, output_buffer do
assert_called_with cache_helper, :output_buffer=, [output_buffer.class.new(output_buffer)] do
assert_nothing_raised do
- cache_helper.send :fragment_for, "Test fragment name", "Test fragment", &Proc.new{ nil }
+ cache_helper.send :fragment_for, "Test fragment name", "Test fragment", &Proc.new { nil }
end
end
end
diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb
index a508c0aae9..898d32c1e2 100644
--- a/actionmailer/test/delivery_methods_test.rb
+++ b/actionmailer/test/delivery_methods_test.rb
@@ -32,7 +32,7 @@ class DefaultsDeliveryMethodsTest < ActiveSupport::TestCase
end
test "default file delivery settings (with Rails.root)" do
- settings = {location: "#{Rails.root}/tmp/mails"}
+ settings = { location: "#{Rails.root}/tmp/mails" }
assert_equal settings, ActionMailer::Base.file_settings
end
@@ -127,16 +127,16 @@ class MailDeliveryTest < ActiveSupport::TestCase
end
test "delivery method options default to class level options" do
- default_options = {a: "b"}
+ default_options = { a: "b" }
ActionMailer::Base.add_delivery_method :optioned, MyOptionedDelivery, default_options
mail_instance = DeliveryMailer.welcome(delivery_method: :optioned)
assert_equal default_options, mail_instance.delivery_method.options
end
test "delivery method options can be overridden per mail instance" do
- default_options = {a: "b"}
+ default_options = { a: "b" }
ActionMailer::Base.add_delivery_method :optioned, MyOptionedDelivery, default_options
- overridden_options = {a: "a"}
+ overridden_options = { a: "a" }
mail_instance = DeliveryMailer.welcome(delivery_method: :optioned, delivery_method_options: overridden_options)
assert_equal overridden_options, mail_instance.delivery_method.options
end
@@ -152,7 +152,7 @@ class MailDeliveryTest < ActiveSupport::TestCase
enable_starttls_auto: true
}
assert_equal settings, ActionMailer::Base.smtp_settings
- overridden_options = {user_name: "overridden", password: "somethingobtuse"}
+ 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]
diff --git a/actionmailer/test/mailers/base_mailer.rb b/actionmailer/test/mailers/base_mailer.rb
index fd7397be84..8ced74c214 100644
--- a/actionmailer/test/mailers/base_mailer.rb
+++ b/actionmailer/test/mailers/base_mailer.rb
@@ -7,7 +7,7 @@ class BaseMailer < ActionMailer::Base
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 = {})
@@ -76,7 +76,7 @@ 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
@@ -88,8 +88,8 @@ class BaseMailer < ActionMailer::Base
def explicit_multipart_with_options(include_html = false)
mail do |format|
- format.text(content_transfer_encoding: "base64"){ render "welcome" }
- format.html{ render "welcome" } if include_html
+ format.text(content_transfer_encoding: "base64") { render "welcome" }
+ format.html { render "welcome" } if include_html
end
end
diff --git a/actionmailer/test/url_test.rb b/actionmailer/test/url_test.rb
index 9e393c9e49..27f6e8a491 100644
--- a/actionmailer/test/url_test.rb
+++ b/actionmailer/test/url_test.rb
@@ -94,7 +94,7 @@ class ActionMailerUrlTest < ActionMailer::TestCase
# hash
assert_url_for "/a/b/c", controller: "a", action: "b", id: "c"
- assert_url_for "/a/b/c", {controller: "a", action: "b", id: "c", only_path: true}, true
+ assert_url_for "/a/b/c", { controller: "a", action: "b", id: "c", only_path: true }, true
# model
assert_url_for "/dummy_model", DummyModel.new