mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Chomp: prefer String#chomp where we can for a clarity boost
Closes #24766, #24767 Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
This commit is contained in:
parent
3136b17b7f
commit
517cf249c3
3 changed files with 5 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
require 'active_support/concern'
|
||||
require 'active_support/core_ext/string/inflections'
|
||||
require 'support/integration/jobs_manager'
|
||||
|
||||
module TestCaseHelpers
|
||||
|
@ -28,7 +29,8 @@ module TestCaseHelpers
|
|||
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 @@ module ActiveModel
|
|||
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 @@ module ActiveModel
|
|||
# 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.
|
||||
|
|
Loading…
Reference in a new issue