brew vendor-gems: commit updates.
This commit is contained in:
parent
53986e9b9a
commit
4a7a16e39b
@ -63,5 +63,5 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10
|
|||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.6.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.6.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.77.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.77.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.5.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.5.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.37.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.37.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"
|
||||||
|
|||||||
@ -6,6 +6,11 @@ module RuboCop
|
|||||||
module FactoryBot
|
module FactoryBot
|
||||||
# Use string value when setting the class attribute explicitly.
|
# Use string value when setting the class attribute explicitly.
|
||||||
#
|
#
|
||||||
|
# This cop would promote faster tests by lazy-loading of
|
||||||
|
# application files. Also, this could help you suppress potential bugs
|
||||||
|
# in combination with external libraries by avoiding a preload of
|
||||||
|
# application files from the factory files.
|
||||||
|
#
|
||||||
# @example
|
# @example
|
||||||
# # bad
|
# # bad
|
||||||
# factory :foo, class: Foo do
|
# factory :foo, class: Foo do
|
||||||
@ -15,7 +20,9 @@ module RuboCop
|
|||||||
# factory :foo, class: 'Foo' do
|
# factory :foo, class: 'Foo' do
|
||||||
# end
|
# end
|
||||||
class FactoryClassName < Cop
|
class FactoryClassName < Cop
|
||||||
MSG = "Pass '%<class_name>s' instead of %<class_name>s."
|
MSG = "Pass '%<class_name>s' string instead of `%<class_name>s` " \
|
||||||
|
'constant.'
|
||||||
|
ALLOWED_CONSTANTS = %w[Hash OpenStruct].freeze
|
||||||
|
|
||||||
def_node_matcher :class_name, <<~PATTERN
|
def_node_matcher :class_name, <<~PATTERN
|
||||||
(send _ :factory _ (hash <(pair (sym :class) $(const ...)) ...>))
|
(send _ :factory _ (hash <(pair (sym :class) $(const ...)) ...>))
|
||||||
@ -23,6 +30,8 @@ module RuboCop
|
|||||||
|
|
||||||
def on_send(node)
|
def on_send(node)
|
||||||
class_name(node) do |cn|
|
class_name(node) do |cn|
|
||||||
|
next if allowed?(cn.const_name)
|
||||||
|
|
||||||
add_offense(cn, message: format(MSG, class_name: cn.const_name))
|
add_offense(cn, message: format(MSG, class_name: cn.const_name))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -32,6 +41,12 @@ module RuboCop
|
|||||||
corrector.replace(node.loc.expression, "'#{node.source}'")
|
corrector.replace(node.loc.expression, "'#{node.source}'")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def allowed?(const_name)
|
||||||
|
ALLOWED_CONSTANTS.include?(const_name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -11,7 +11,7 @@ module RuboCop
|
|||||||
#
|
#
|
||||||
# # better
|
# # better
|
||||||
# thing = Thing.new(baz: 42)
|
# thing = Thing.new(baz: 42)
|
||||||
# allow(foo).to receive(bar: thing)
|
# allow(foo).to receive(:bar).and_return(thing)
|
||||||
#
|
#
|
||||||
class MessageChain < Cop
|
class MessageChain < Cop
|
||||||
MSG = 'Avoid stubbing using `%<method>s`.'
|
MSG = 'Avoid stubbing using `%<method>s`.'
|
||||||
@ -9,7 +9,7 @@ require_relative 'rspec/factory_bot/factory_class_name'
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
require_relative 'rspec/rails/http_status'
|
require_relative 'rspec/rails/http_status'
|
||||||
rescue LoadError # rubocop:disable Lint/HandleExceptions
|
rescue LoadError # rubocop:disable Lint/SuppressedException
|
||||||
# Rails/HttpStatus cannot be loaded if rack/utils is unavailable.
|
# Rails/HttpStatus cannot be loaded if rack/utils is unavailable.
|
||||||
end
|
end
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user