1
0
Fork 0
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:
lvl0nax 2016-04-28 15:18:51 +03:00 committed by Jeremy Daer
parent 3136b17b7f
commit 517cf249c3
No known key found for this signature in database
GPG key ID: AB8F6399D5C60664
3 changed files with 5 additions and 7 deletions

View file

@ -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)

View file

@ -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

View file

@ -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.