提交 4c8c8c87 编写于 作者: R Ryuta Kamizono

Address to rubocop offences

上级 511d1abc
......@@ -122,7 +122,7 @@ def order_hacks(o)
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
......
......@@ -269,7 +269,7 @@ def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)
# 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("::")
......
......@@ -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 }
......
......@@ -790,7 +790,7 @@ def index
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
......
......@@ -308,7 +308,7 @@ def test_scaffold_with_namespace_on_revoke
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 @@ def test_scaffold_with_nested_namespace_on_revoke
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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册