aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-07-31 17:42:27 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-07-31 17:48:14 +0900
commit4c8c8c87b07844b26564ca6aa2052660e601bc3d (patch)
treec6e1863a91618c017de9c5fd92a8240b177256e7
parent511d1abc8ad523aa3592e30b4ecf4dac92a2a352 (diff)
downloadrails-4c8c8c87b07844b26564ca6aa2052660e601bc3d.tar.gz
rails-4c8c8c87b07844b26564ca6aa2052660e601bc3d.tar.bz2
rails-4c8c8c87b07844b26564ca6aa2052660e601bc3d.zip
Address to rubocop offences
-rw-r--r--activerecord/lib/arel/visitors/oracle.rb2
-rw-r--r--activesupport/lib/active_support/inflector/methods.rb2
-rw-r--r--railties/lib/rails/tasks/framework.rake2
-rw-r--r--railties/test/application/configuration_test.rb2
-rw-r--r--railties/test/generators/namespaced_generators_test.rb4
5 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/arel/visitors/oracle.rb b/activerecord/lib/arel/visitors/oracle.rb
index c54aec71a6..a0a74d365c 100644
--- a/activerecord/lib/arel/visitors/oracle.rb
+++ b/activerecord/lib/arel/visitors/oracle.rb
@@ -122,7 +122,7 @@ module Arel # :nodoc: all
o.orders = []
orders.each_with_index do |order, i|
o.orders <<
- Nodes::SqlLiteral.new("alias_#{i}__#{' DESC' if /\bdesc$/i === order}")
+ Nodes::SqlLiteral.new("alias_#{i}__#{' DESC' if /\bdesc$/i.match?(order)}")
end
o
end
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb
index 2c0323396f..94d1115ccf 100644
--- a/activesupport/lib/active_support/inflector/methods.rb
+++ b/activesupport/lib/active_support/inflector/methods.rb
@@ -269,7 +269,7 @@ module ActiveSupport
# NameError is raised when the name is not in CamelCase or the constant is
# unknown.
def constantize(camel_cased_word)
- if camel_cased_word.blank? || !camel_cased_word.include?('::')
+ if camel_cased_word.blank? || !camel_cased_word.include?("::")
Object.const_get(camel_cased_word)
else
names = camel_cased_word.split("::")
diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake
index 2886986865..c0f19fcfe5 100644
--- a/railties/lib/rails/tasks/framework.rake
+++ b/railties/lib/rails/tasks/framework.rake
@@ -8,7 +8,7 @@ namespace :app do
task template: :environment do
template = ENV["LOCATION"]
raise "No LOCATION value given. Please set LOCATION either as path to a file or a URL" if template.blank?
- template = File.expand_path(template) if template !~ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://}
+ template = File.expand_path(template) unless %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://}.match?(template)
require "rails/generators"
require "rails/generators/rails/app/app_generator"
generator = Rails::Generators::AppGenerator.new [Rails.root], {}, { destination_root: Rails.root }
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index cca86bc13a..b44edbc7d3 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -790,7 +790,7 @@ module ApplicationTests
end
get "/"
- assert /csrf\-param/.match?(last_response.body)
+ assert_match(/csrf\-param/, last_response.body)
end
test "default form builder specified as a string" do
diff --git a/railties/test/generators/namespaced_generators_test.rb b/railties/test/generators/namespaced_generators_test.rb
index 4b75a31f17..12ccbe6ff1 100644
--- a/railties/test/generators/namespaced_generators_test.rb
+++ b/railties/test/generators/namespaced_generators_test.rb
@@ -308,7 +308,7 @@ class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase
run_generator [ "admin/role" ], behavior: :revoke
# Model
- assert_file "app/models/test_app/admin.rb" # ( should not be remove )
+ assert_file "app/models/test_app/admin.rb" # ( should not be remove )
assert_no_file "app/models/test_app/admin/role.rb"
assert_no_file "test/models/test_app/admin/role_test.rb"
assert_no_file "test/fixtures/test_app/admin/roles.yml"
@@ -375,7 +375,7 @@ class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase
run_generator [ "admin/user/special/role" ], behavior: :revoke
# Model
- assert_file "app/models/test_app/admin/user/special.rb" # ( should not be remove )
+ assert_file "app/models/test_app/admin/user/special.rb" # ( should not be remove )
assert_no_file "app/models/test_app/admin/user/special/role.rb"
assert_no_file "test/models/test_app/admin/user/special/role_test.rb"
assert_no_file "test/fixtures/test_app/admin/user/special/roles.yml"