brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2022-12-13 09:34:19 +00:00
parent feabf4977f
commit 00d3fb3276
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
143 changed files with 446 additions and 106 deletions

View File

@ -107,7 +107,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.35.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.15.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.16.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-html-0.12.3/lib")

View File

@ -147,13 +147,17 @@ RSpec/Be:
RSpec/BeEq:
Description: Check for expectations where `be(...)` can replace `eq(...)`.
Enabled: pending
Safe: false
VersionAdded: 2.9.0
VersionChanged: '2.16'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq
RSpec/BeEql:
Description: Check for expectations where `be(...)` can replace `eql(...)`.
Enabled: true
Safe: false
VersionAdded: '1.7'
VersionChanged: '2.16'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
RSpec/BeNil:
@ -284,6 +288,12 @@ RSpec/Dialect:
VersionAdded: '1.33'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
RSpec/DuplicatedMetadata:
Description: Avoid duplicated metadata.
Enabled: pending
VersionAdded: '2.16'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata
RSpec/EmptyExampleGroup:
Description: Checks if an example group does not include any tests.
Enabled: true
@ -356,12 +366,6 @@ RSpec/ExampleWithoutDescription:
VersionAdded: '1.22'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
RSpec/ExcessiveDocstringSpacing:
Description: Checks for excessive whitespace in example descriptions.
Enabled: pending
VersionAdded: '2.5'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
RSpec/ExampleWording:
Description: Checks for common mistakes in example descriptions.
Enabled: true
@ -378,6 +382,12 @@ RSpec/ExampleWording:
StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
RSpec/ExcessiveDocstringSpacing:
Description: Checks for excessive whitespace in example descriptions.
Enabled: pending
VersionAdded: '2.5'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
RSpec/ExpectActual:
Description: Checks for `expect(...)` calls containing literal values.
Enabled: true
@ -664,6 +674,12 @@ RSpec/Pending:
VersionAdded: '1.25'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
RSpec/PendingWithoutReason:
Description: Checks for pending or skipped examples without reason.
Enabled: pending
VersionAdded: '2.16'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason
RSpec/PredicateMatcher:
Description: Prefer using predicate matcher over using predicate method directly.
Enabled: true
@ -960,6 +976,16 @@ RSpec/FactoryBot/FactoryClassName:
VersionChanged: '2.0'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
RSpec/FactoryBot/FactoryNameStyle:
Description: Checks for name style for argument of FactoryBot::Syntax::Methods.
Enabled: pending
VersionAdded: '2.16'
EnforcedStyle: symbol
SupportedStyles:
- symbol
- string
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle
RSpec/FactoryBot/SyntaxMethods:
Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
Enabled: pending
@ -985,6 +1011,17 @@ RSpec/Rails/HaveHttpStatus:
VersionAdded: '2.12'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus
RSpec/Rails/HttpStatus:
Description: Enforces use of symbolic or numeric value to describe HTTP status.
Enabled: true
EnforcedStyle: symbolic
SupportedStyles:
- numeric
- symbolic
VersionAdded: '1.23'
VersionChanged: '2.0'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
RSpec/Rails/InferredSpecType:
Description: Identifies redundant spec type.
Enabled: pending
@ -1007,14 +1044,3 @@ RSpec/Rails/InferredSpecType:
routing: routing
system: system
views: view
RSpec/Rails/HttpStatus:
Description: Enforces use of symbolic or numeric value to describe HTTP status.
Enabled: true
EnforcedStyle: symbolic
SupportedStyles:
- numeric
- symbolic
VersionAdded: '1.23'
VersionChanged: '2.0'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus

View File

@ -6,34 +6,39 @@ require 'yaml'
require 'rubocop'
require_relative 'rubocop/rspec'
require_relative 'rubocop/rspec/version'
require_relative 'rubocop/rspec/inject'
require_relative 'rubocop/rspec/node'
require_relative 'rubocop/rspec/wording'
require_relative 'rubocop/rspec/language/node_pattern'
require_relative 'rubocop/rspec/node'
require_relative 'rubocop/rspec/version'
require_relative 'rubocop/rspec/wording'
# Dependent on `RuboCop::RSpec::Language::NodePattern`.
require_relative 'rubocop/rspec/language'
require_relative 'rubocop/rspec/factory_bot/language'
require_relative 'rubocop/cop/rspec/mixin/capybara_help'
require_relative 'rubocop/cop/rspec/mixin/css_selector'
require_relative 'rubocop/cop/rspec/mixin/final_end_location'
require_relative 'rubocop/cop/rspec/mixin/inside_example_group'
require_relative 'rubocop/cop/rspec/mixin/metadata'
require_relative 'rubocop/cop/rspec/mixin/namespace'
require_relative 'rubocop/cop/rspec/mixin/skip_or_pending'
require_relative 'rubocop/cop/rspec/mixin/top_level_group'
require_relative 'rubocop/cop/rspec/mixin/variable'
require_relative 'rubocop/cop/rspec/mixin/final_end_location'
# Dependent on `RuboCop::Cop::RSpec::FinalEndLocation`.
require_relative 'rubocop/cop/rspec/mixin/comments_help'
require_relative 'rubocop/cop/rspec/mixin/empty_line_separation'
require_relative 'rubocop/cop/rspec/mixin/inside_example_group'
require_relative 'rubocop/cop/rspec/mixin/namespace'
require_relative 'rubocop/cop/rspec/mixin/css_selector'
require_relative 'rubocop/cop/rspec/mixin/skip_or_pending'
require_relative 'rubocop/cop/rspec/mixin/capybara_help'
require_relative 'rubocop/rspec/concept'
require_relative 'rubocop/rspec/example_group'
require_relative 'rubocop/rspec/example'
require_relative 'rubocop/rspec/hook'
require_relative 'rubocop/cop/rspec/base'
require_relative 'rubocop/rspec/align_let_brace'
require_relative 'rubocop/rspec/factory_bot'
require_relative 'rubocop/rspec/concept'
require_relative 'rubocop/rspec/corrector/move_node'
require_relative 'rubocop/rspec/example'
require_relative 'rubocop/rspec/example_group'
require_relative 'rubocop/rspec/factory_bot'
require_relative 'rubocop/rspec/hook'
RuboCop::RSpec::Inject.defaults!

View File

@ -21,6 +21,8 @@ module RuboCop
class Be < Base
MSG = "Don't use `be` without an argument."
RESTRICT_ON_SEND = Runners.all
# @!method be_without_args(node)
def_node_matcher :be_without_args, <<-PATTERN
(send _ #Runners.all $(send nil? :be))

View File

@ -9,6 +9,9 @@ module RuboCop
# using `==`. Booleans and nil can be compared by identity and therefore
# the `be` matcher is preferable as it is a more strict test.
#
# @safety
# This cop is unsafe because it changes how values are compared.
#
# @example
# # bad
# expect(foo).to eq(true)

View File

@ -10,6 +10,9 @@ module RuboCop
# can be compared by identity and therefore the `be` matcher is
# preferable as it is a more strict test.
#
# @safety
# This cop is unsafe because it changes how values are compared.
#
# @example
# # bad
# expect(foo).to eql(1)

View File

@ -29,7 +29,7 @@ module RuboCop
# # good
# expect(page).to have_current_path('/callback')
#
class CurrentPathExpectation < Base
class CurrentPathExpectation < ::RuboCop::Cop::Base
extend AutoCorrector
MSG = 'Do not set an RSpec expectation on `current_path` in ' \
@ -47,14 +47,14 @@ module RuboCop
# @!method as_is_matcher(node)
def_node_matcher :as_is_matcher, <<-PATTERN
(send
#expectation_set_on_current_path $#Runners.all
#expectation_set_on_current_path ${:to :to_not :not_to}
${(send nil? :eq ...) (send nil? :match (regexp ...))})
PATTERN
# @!method regexp_str_matcher(node)
def_node_matcher :regexp_str_matcher, <<-PATTERN
(send
#expectation_set_on_current_path $#Runners.all
#expectation_set_on_current_path ${:to :to_not :not_to}
$(send nil? :match (str $_)))
PATTERN

View File

@ -24,7 +24,7 @@ module RuboCop
# expect(page).to have_no_selector
# expect(page).to have_no_css('a')
#
class NegationMatcher < Base
class NegationMatcher < ::RuboCop::Cop::Base
extend AutoCorrector
include ConfigurableEnforcedStyle

View File

@ -20,7 +20,7 @@ module RuboCop
# click_link(exact_text: 'foo')
# find('div').click_button
#
class SpecificActions < Base
class SpecificActions < ::RuboCop::Cop::Base
MSG = "Prefer `%<good_action>s` over `find('%<selector>s').click`."
RESTRICT_ON_SEND = %i[click].freeze
SPECIFIC_ACTION = {

View File

@ -15,7 +15,7 @@ module RuboCop
# find_by_id('some-id')
# find_by_id('some-id', visible: true)
#
class SpecificFinders < Base
class SpecificFinders < ::RuboCop::Cop::Base
extend AutoCorrector
include RangeHelp

View File

@ -26,9 +26,7 @@ module RuboCop
# expect(page).to have_select
# expect(page).to have_field('foo')
#
class SpecificMatcher < Base
include CapybaraHelp
class SpecificMatcher < ::RuboCop::Cop::Base
MSG = 'Prefer `%<good_matcher>s` over `%<bad_matcher>s`.'
RESTRICT_ON_SEND = %i[have_selector have_no_selector have_css
have_no_css].freeze
@ -49,8 +47,8 @@ module RuboCop
first_argument(node) do |arg|
next unless (matcher = specific_matcher(arg))
next if CssSelector.multiple_selectors?(arg)
next unless specific_option?(node, arg, matcher)
next unless specific_pseudo_classes?(arg)
next unless CapybaraHelp.specific_option?(node, arg, matcher)
next unless CapybaraHelp.specific_pseudo_classes?(arg)
add_offense(node, message: message(node, matcher))
end

View File

@ -26,7 +26,7 @@ module RuboCop
# expect(page).to have_css('.foo', visible: :all)
# expect(page).to have_link('my link', visible: :hidden)
#
class VisibilityMatcher < Base
class VisibilityMatcher < ::RuboCop::Cop::Base
MSG_FALSE = 'Use `:all` or `:hidden` instead of `false`.'
MSG_TRUE = 'Use `:visible` instead of `true`.'
CAPYBARA_MATCHER_METHODS = %w[

View File

@ -0,0 +1,58 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Avoid duplicated metadata.
#
# @example
# # bad
# describe 'Something', :a, :a
#
# # good
# describe 'Something', :a
class DuplicatedMetadata < Base
extend AutoCorrector
include Metadata
include RangeHelp
MSG = 'Avoid duplicated metadata.'
def on_metadata(symbols, _pairs)
symbols.each do |symbol|
on_metadata_symbol(symbol)
end
end
private
def on_metadata_symbol(node)
return unless duplicated?(node)
add_offense(node) do |corrector|
autocorrect(corrector, node)
end
end
def autocorrect(corrector, node)
corrector.remove(
range_with_surrounding_comma(
range_with_surrounding_space(
node.location.expression,
side: :left
),
:left
)
)
end
def duplicated?(node)
node.left_siblings.any? do |sibling|
sibling.eql?(node)
end
end
end
end
end
end

View File

@ -55,6 +55,8 @@ module RuboCop
end
end
private
def allowed_one_liner?(node)
consecutive_one_liner?(node) && allow_consecutive_one_liners?
end

View File

@ -26,6 +26,8 @@ module RuboCop
MSG = 'Provide the actual you are testing to `expect(...)`.'
RESTRICT_ON_SEND = Runners.all
SIMPLE_LITERALS = %i[
true
false

View File

@ -25,7 +25,7 @@ module RuboCop
# # good
# count { 1 }
#
class AttributeDefinedStatically < Base
class AttributeDefinedStatically < ::RuboCop::Cop::Base
extend AutoCorrector
MSG = 'Use a block to declare attribute values.'

View File

@ -40,7 +40,7 @@ module RuboCop
# name: 'foo'
# )
#
class ConsistentParenthesesStyle < Base
class ConsistentParenthesesStyle < ::RuboCop::Cop::Base
extend AutoCorrector
include ConfigurableEnforcedStyle
include RuboCop::RSpec::FactoryBot::Language
@ -69,6 +69,8 @@ module RuboCop
return if ambiguous_without_parentheses?(node)
factory_call(node) do
return if node.method?(:generate) && node.arguments.count > 1
if node.parenthesized?
process_with_parentheses(node)
else
@ -77,6 +79,8 @@ module RuboCop
end
end
private
def process_with_parentheses(node)
return unless style == :omit_parentheses
return unless same_line?(node, node.first_argument)
@ -102,8 +106,6 @@ module RuboCop
node.parent&.array_type?
end
private
def remove_parentheses(corrector, node)
corrector.replace(node.location.begin, ' ')
corrector.remove(node.location.end)

View File

@ -31,7 +31,7 @@ module RuboCop
# # good
# 3.times { create :user }
#
class CreateList < Base
class CreateList < ::RuboCop::Cop::Base
extend AutoCorrector
include ConfigurableEnforcedStyle
include RuboCop::RSpec::FactoryBot::Language
@ -143,7 +143,7 @@ module RuboCop
def call(corrector)
replacement = generate_n_times_block(node)
corrector.replace(node, replacement)
corrector.replace(node.block_node || node, replacement)
end
private
@ -159,8 +159,15 @@ module RuboCop
replacement = format_receiver(node.receiver)
replacement += format_method_call(node, 'create', arguments)
replacement += " #{factory_call_block_source}" if node.block_node
"#{count.source}.times { #{replacement} }"
end
def factory_call_block_source
node.block_node.location.begin.with(
end_pos: node.block_node.location.end.end_pos
).source
end
end
# :nodoc:

View File

@ -20,7 +20,7 @@ module RuboCop
# factory :foo, class: 'Foo' do
# end
#
class FactoryClassName < Base
class FactoryClassName < ::RuboCop::Cop::Base
extend AutoCorrector
MSG = "Pass '%<class_name>s' string instead of `%<class_name>s` " \

View File

@ -0,0 +1,74 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
module FactoryBot
# Checks for name style for argument of FactoryBot::Syntax::Methods.
#
# @example EnforcedStyle: symbol (default)
# # bad
# create('user')
# build "user", username: "NAME"
#
# # good
# create(:user)
# build :user, username: "NAME"
#
# @example EnforcedStyle: string
# # bad
# create(:user)
# build :user, username: "NAME"
#
# # good
# create('user')
# build "user", username: "NAME"
#
class FactoryNameStyle < ::RuboCop::Cop::Base
extend AutoCorrector
include ConfigurableEnforcedStyle
include RuboCop::RSpec::FactoryBot::Language
MSG = 'Use %<prefer>s to refer to a factory.'
FACTORY_CALLS = RuboCop::RSpec::FactoryBot::Language::METHODS
RESTRICT_ON_SEND = FACTORY_CALLS
# @!method factory_call(node)
def_node_matcher :factory_call, <<-PATTERN
(send
{#factory_bot? nil?} %FACTORY_CALLS
${str sym} ...
)
PATTERN
def on_send(node)
factory_call(node) do |name|
if offense_for_symbol_style?(name)
register_offense(name, name.value.to_sym.inspect)
elsif offense_for_string_style?(name)
register_offense(name, name.value.to_s.inspect)
end
end
end
private
def offense_for_symbol_style?(name)
name.str_type? && style == :symbol
end
def offense_for_string_style?(name)
name.sym_type? && style == :string
end
def register_offense(name, prefer)
add_offense(name,
message: format(MSG, prefer: style.to_s)) do |corrector|
corrector.replace(name, prefer)
end
end
end
end
end
end
end

View File

@ -28,6 +28,8 @@ module RuboCop
MSG = 'Prefer `%<good>s` over `%<bad>s`.'
RESTRICT_ON_SEND = Runners.all + %i[should should_not]
# @!method implicit_expect(node)
def_node_matcher :implicit_expect, <<-PATTERN
{

View File

@ -44,6 +44,8 @@ module RuboCop
check_previous_nodes(node)
end
private
def check_previous_nodes(node)
offending_node(node) do |offender|
msg = format(MSG, offending: offender.method_name)
@ -53,8 +55,6 @@ module RuboCop
end
end
private
def offending_node(node)
parent(node).each_child_node.find do |sibling|
break if sibling.equal?(node)

View File

@ -41,6 +41,8 @@ module RuboCop
SUPPORTED_STYLES = %w[have_received receive].freeze
RESTRICT_ON_SEND = Runners.all
# @!method message_expectation(node)
def_node_matcher :message_expectation, %(
(send (send nil? :expect $_) #Runners.all ...)

View File

@ -0,0 +1,49 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Helper methods to find RSpec metadata.
module Metadata
extend RuboCop::NodePattern::Macros
include RuboCop::RSpec::Language
# @!method rspec_metadata(node)
def_node_matcher :rspec_metadata, <<~PATTERN
(block
(send
#rspec? {#Examples.all #ExampleGroups.all #SharedGroups.all #Hooks.all} _ ${send str sym}* (hash $...)?)
...)
PATTERN
# @!method rspec_configure(node)
def_node_matcher :rspec_configure, <<~PATTERN
(block (send #rspec? :configure) (args (arg $_)) ...)
PATTERN
# @!method metadata_in_block(node)
def_node_search :metadata_in_block, <<~PATTERN
(send (lvar %) #Hooks.all _ ${send str sym}* (hash $...)?)
PATTERN
def on_block(node)
rspec_configure(node) do |block_var|
metadata_in_block(node, block_var) do |symbols, pairs|
on_metadata(symbols, pairs.flatten)
end
end
rspec_metadata(node) do |symbols, pairs|
on_metadata(symbols, pairs.flatten)
end
end
alias on_numblock on_block
def on_metadata(_symbols, _pairs)
raise ::NotImplementedError
end
end
end
end
end

View File

@ -0,0 +1,123 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Checks for pending or skipped examples without reason.
#
# @example
# # bad
# pending 'does something' do
# end
#
# # bad
# it 'does something', :pending do
# end
#
# # bad
# it 'does something' do
# pending
# end
#
# # bad
# xdescribe 'something' do
# end
#
# # bad
# skip 'does something' do
# end
#
# # bad
# it 'does something', :skip do
# end
#
# # bad
# it 'does something' do
# skip
# end
#
# # bad
# it 'does something'
#
# # good
# it 'does something' do
# pending 'reason'
# end
#
# # good
# it 'does something' do
# skip 'reason'
# end
#
# # good
# it 'does something', pending: 'reason' do
# end
#
# # good
# it 'does something', skip: 'reason' do
# end
class PendingWithoutReason < Base
MSG = 'Give the reason for pending or skip.'
# @!method pending_by_example_method?(node)
def_node_matcher :pending_by_example_method?, block_pattern(<<~PATTERN)
#Examples.pending
PATTERN
# @!method pending_by_metadata_without_reason?(node)
def_node_matcher :pending_by_metadata_without_reason?, <<~PATTERN
(send #rspec? {#ExampleGroups.all #Examples.all} ... {<(sym :pending) ...> (hash <(pair (sym :pending) true) ...>)})
PATTERN
# @!method skipped_by_example_method?(node)
def_node_matcher :skipped_by_example_method?, block_pattern(<<~PATTERN)
#Examples.skipped
PATTERN
# @!method skipped_by_example_group_method?(node)
def_node_matcher(
:skipped_by_example_group_method?,
block_pattern(<<~PATTERN)
#ExampleGroups.skipped
PATTERN
)
# @!method skipped_by_metadata_without_reason?(node)
def_node_matcher :skipped_by_metadata_without_reason?, <<~PATTERN
(send #rspec? {#ExampleGroups.all #Examples.all} ... {<(sym :skip) ...> (hash <(pair (sym :skip) true) ...>)})
PATTERN
def on_send(node)
if pending_without_reason?(node)
add_offense(node, message: 'Give the reason for pending.')
elsif skipped_without_reason?(node)
add_offense(node, message: 'Give the reason for skip.')
end
end
private
def pending_by_pending_step_without_reason?(node)
node.method?(:pending) && node.first_argument.nil?
end
def pending_without_reason?(node)
pending_by_example_method?(node.block_node) ||
pending_by_metadata_without_reason?(node) ||
pending_by_pending_step_without_reason?(node)
end
def skipped_by_skip_step_without_reason?(node)
node.method?(:skip) && node.first_argument.nil?
end
def skipped_without_reason?(node)
skipped_by_example_group_method?(node.block_node) ||
skipped_by_example_method?(node.block_node) ||
skipped_by_metadata_without_reason?(node) ||
skipped_by_skip_step_without_reason?(node)
end
end
end
end
end

View File

@ -283,6 +283,8 @@ module RuboCop
include InflectedHelper
include ExplicitHelper
RESTRICT_ON_SEND = Runners.all
def on_send(node)
case style
when :inflected

View File

@ -13,20 +13,23 @@ module RuboCop
# # good
# expect(response).to have_http_status(200)
#
class HaveHttpStatus < Base
class HaveHttpStatus < ::RuboCop::Cop::Base
extend AutoCorrector
MSG =
'Prefer `expect(response).%<to>s have_http_status(%<status>i)` ' \
'over `expect(response.status).%<to>s %<match>s`.'
RUNNERS = %i[to to_not not_to].to_set
RESTRICT_ON_SEND = RUNNERS
# @!method match_status(node)
def_node_matcher :match_status, <<-PATTERN
(send
(send nil? :expect
$(send (send nil? :response) :status)
)
$#Runners.all
$RUNNERS
$(send nil? {:be :eq :eql :equal} (int $_))
)
PATTERN

View File

@ -33,7 +33,7 @@ module RuboCop
#
# @example `Inferences` configuration
# # .rubocop.yml
# # RSpec/InferredSpecType:
# # RSpec/Rails/InferredSpecType:
# # Inferences:
# # services: service
#

Some files were not shown because too many files have changed in this diff Show More