未验证 提交 517cf249 编写于 作者: L lvl0nax 提交者: Jeremy Daer

Chomp: prefer String#chomp where we can for a clarity boost

Closes #24766, #24767
Signed-off-by: NJeremy Daer <jeremydaer@gmail.com>
上级 3136b17b
require 'active_support/concern'
require 'active_support/core_ext/string/inflections'
require 'support/integration/jobs_manager'
module TestCaseHelpers
......@@ -28,7 +29,8 @@ def clear_jobs
end
def adapter_is?(*adapter_class_symbols)
adapter_class_symbols.map(&:to_s).include?(ActiveJob::Base.queue_adapter.class.name.split("::").last.gsub(/Adapter$/, '').underscore)
adapter = ActiveJob::Base.queue_adapter.class.name.demodulize.chomp('Adapter').underscore
adapter_class_symbols.map(&:to_s).include? adapter
end
def wait_for_jobs_to_finish_for(seconds=60)
......
......@@ -64,11 +64,7 @@ def define_on(klass)
private
def convert_to_reader_name(method_name)
attr_name = method_name.to_s
if attr_name.end_with?("=")
attr_name = attr_name[0..-2]
end
attr_name
method_name.to_s.chomp('=')
end
end
end
......
......@@ -100,7 +100,7 @@ class Validator
# PresenceValidator.kind # => :presence
# UniquenessValidator.kind # => :uniqueness
def self.kind
@kind ||= name.split('::').last.underscore.sub(/_validator$/, '').to_sym unless anonymous?
@kind ||= name.split('::').last.underscore.chomp('_validator').to_sym unless anonymous?
end
# Accepts options that will be made available through the +options+ reader.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册