brew vendor-gems: commit updates.

This commit is contained in:
Mike McQuaid 2020-06-11 12:57:57 +01:00
parent 2b93177237
commit 390c3e269f
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
109 changed files with 371 additions and 123 deletions

View File

@ -10,7 +10,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.7/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.3.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.1/lib"
$:.unshift "#{path}/"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/byebug-11.1.3"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/byebug-11.1.3/lib"
@ -45,13 +45,13 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/webrobots-0.1.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.7.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mustache-1.1.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.19.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-2.32.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-3.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.7.1.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/rdiscount-2.2.0.1"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rdiscount-2.2.0.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/regexp_parser-1.7.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/regexp_parser-1.7.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rexml-3.2.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ronn-0.7.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-support-3.9.3/lib"
@ -65,7 +65,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-0.0.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.85.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.85.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.6.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.39.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.40.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"

View File

@ -13,31 +13,37 @@ AllCops:
RSpec/AlignLeftLetBrace:
Description: Checks that left braces for adjacent single line lets are aligned.
Enabled: false
VersionAdded: '1.16'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
RSpec/AlignRightLetBrace:
Description: Checks that right braces for adjacent single line lets are aligned.
Enabled: false
VersionAdded: '1.16'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
RSpec/AnyInstance:
Description: Check that instances are not being stubbed globally.
Enabled: true
VersionAdded: '1.4'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
RSpec/AroundBlock:
Description: Checks that around blocks actually run the test.
Enabled: true
VersionAdded: '1.11'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
RSpec/Be:
Description: Check for expectations where `be` is used without argument.
Enabled: true
VersionAdded: '1.25'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
RSpec/BeEql:
Description: Check for expectations where `be(...)` can replace `eql(...)`.
Enabled: true
VersionAdded: '1.7'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
RSpec/BeforeAfterAll:
@ -47,11 +53,13 @@ RSpec/BeforeAfterAll:
- spec/spec_helper.rb
- spec/rails_helper.rb
- spec/support/**/*.rb
VersionAdded: '1.12'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
RSpec/ContextMethod:
Description: "`context` should not be used for specifying methods."
Enabled: true
VersionAdded: '1.36'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
RSpec/ContextWording:
@ -61,86 +69,103 @@ RSpec/ContextWording:
- when
- with
- without
VersionAdded: '1.20'
VersionChanged: 1.20.1
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
RSpec/DescribeClass:
Description: Check that the first argument to the top level describe is a constant.
Enabled: true
VersionAdded: '1.0'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
RSpec/DescribeMethod:
Description: Checks that the second argument to `describe` specifies a method.
Enabled: true
VersionAdded: '1.0'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
RSpec/DescribeSymbol:
Description: Avoid describing symbols.
Enabled: true
VersionAdded: '1.15'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
RSpec/DescribedClass:
Description: Checks that tests use `described_class`.
SkipBlocks: false
Enabled: true
SkipBlocks: false
EnforcedStyle: described_class
SupportedStyles:
- described_class
- explicit
SafeAutoCorrect: false
VersionAdded: '1.0'
VersionChanged: '1.11'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
RSpec/DescribedClassModuleWrapping:
Description: Avoid opening modules and defining specs within them.
Enabled: false
VersionAdded: '1.37'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
RSpec/Dialect:
Description: This cop enforces custom RSpec dialects.
Enabled: false
PreferredMethods: {}
VersionAdded: '1.33'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
RSpec/EmptyExampleGroup:
Description: Checks if an example group does not include any tests.
Enabled: true
CustomIncludeMethods: []
VersionAdded: '1.7'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
RSpec/EmptyHook:
Description: Checks for empty before and after hooks.
Enabled: true
VersionAdded: 1.39.0
VersionAdded: '1.39'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
RSpec/EmptyLineAfterExample:
Description: Checks if there is an empty line after example blocks.
Enabled: true
AllowConsecutiveOneLiners: true
VersionAdded: '1.36'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
RSpec/EmptyLineAfterExampleGroup:
Description: Checks if there is an empty line after example group blocks.
Enabled: true
VersionAdded: '1.27'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
RSpec/EmptyLineAfterFinalLet:
Description: Checks if there is an empty line after the last let block.
Enabled: true
VersionAdded: '1.14'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
RSpec/EmptyLineAfterHook:
Description: Checks if there is an empty line after hook blocks.
Enabled: true
VersionAdded: '1.27'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
RSpec/EmptyLineAfterSubject:
Description: Checks if there is an empty line after subject block.
Enabled: true
VersionAdded: '1.14'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
RSpec/ExampleLength:
Description: Checks for long examples.
Enabled: true
Max: 5
VersionAdded: '1.5'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
RSpec/ExampleWithoutDescription:
@ -151,6 +176,7 @@ RSpec/ExampleWithoutDescription:
- always_allow
- single_line_only
- disallow
VersionAdded: '1.22'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
RSpec/ExampleWording:
@ -162,6 +188,8 @@ RSpec/ExampleWording:
have: has
HAVE: HAS
IgnoredWords: []
VersionAdded: '1.0'
VersionChanged: '1.2'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
RSpec/ExpectActual:
@ -169,6 +197,7 @@ RSpec/ExpectActual:
Enabled: true
Exclude:
- spec/routing/**/*
VersionAdded: '1.7'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
RSpec/ExpectChange:
@ -178,30 +207,37 @@ RSpec/ExpectChange:
SupportedStyles:
- method_call
- block
VersionAdded: '1.22'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
RSpec/ExpectInHook:
Enabled: true
Description: Do not use `expect` in hooks such as `before`.
Enabled: true
VersionAdded: '1.16'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
RSpec/ExpectOutput:
Description: Checks for opportunities to use `expect { ... }.to output`.
Enabled: true
VersionAdded: '1.10'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
RSpec/FilePath:
Description: Checks that spec file paths are consistent with the test subject.
Description: Checks that spec file paths are consistent and well-formed.
Enabled: true
CustomTransform:
RuboCop: rubocop
RSpec: rspec
IgnoreMethods: false
SpecSuffixOnly: false
VersionAdded: '1.2'
VersionChanged: '1.40'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
RSpec/Focus:
Description: Checks if examples are focused.
Enabled: true
VersionAdded: '1.5'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
RSpec/HookArgument:
@ -212,16 +248,19 @@ RSpec/HookArgument:
- implicit
- each
- example
VersionAdded: '1.7'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
RSpec/HooksBeforeExamples:
Enabled: true
Description: Checks for before/around/after hooks that come after an example.
Enabled: true
VersionAdded: '1.29'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
RSpec/ImplicitBlockExpectation:
Description: Check that implicit block expectation syntax is not used.
Enabled: true
VersionAdded: '1.35'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
RSpec/ImplicitExpect:
@ -231,32 +270,39 @@ RSpec/ImplicitExpect:
SupportedStyles:
- is_expected
- should
VersionAdded: '1.8'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
RSpec/ImplicitSubject:
Enabled: true
Description: Checks for usage of implicit subject (`is_expected` / `should`).
Enabled: true
EnforcedStyle: single_line_only
SupportedStyles:
- single_line_only
- single_statement_only
- disallow
VersionAdded: '1.29'
VersionChanged: '1.30'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
RSpec/InstanceSpy:
Description: Checks for `instance_double` used with `have_received`.
Enabled: true
VersionAdded: '1.12'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
RSpec/InstanceVariable:
Description: Checks for instance variable usage in specs.
AssignmentOnly: false
Enabled: true
AssignmentOnly: false
VersionAdded: '1.0'
VersionChanged: '1.7'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
RSpec/InvalidPredicateMatcher:
Description: Checks invalid usage for predicate matcher.
Enabled: true
VersionAdded: '1.16'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InvalidPredicateMatcher
RSpec/ItBehavesLike:
@ -266,36 +312,45 @@ RSpec/ItBehavesLike:
SupportedStyles:
- it_behaves_like
- it_should_behave_like
VersionAdded: '1.13'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
RSpec/IteratedExpectation:
Description: Check that `all` matcher is used instead of iterating over an array.
Enabled: true
VersionAdded: '1.14'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
RSpec/LeadingSubject:
Description: Enforce that subject is the first definition in the test.
Enabled: true
VersionAdded: '1.7'
VersionChanged: '1.14'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
RSpec/LeakyConstantDeclaration:
Description: Checks that no class, module, or constant is declared.
Enabled: true
VersionAdded: '1.35'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
RSpec/LetBeforeExamples:
Description: Checks for `let` definitions that come after an example.
Enabled: true
VersionAdded: '1.16'
VersionChanged: '1.22'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
RSpec/LetSetup:
Description: Checks unreferenced `let!` calls being used for test setup.
Enabled: true
VersionAdded: '1.7'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
RSpec/MessageChain:
Description: Check that chains of messages are not being stubbed.
Enabled: true
VersionAdded: '1.7'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
RSpec/MessageExpectation:
@ -305,6 +360,8 @@ RSpec/MessageExpectation:
SupportedStyles:
- allow
- expect
VersionAdded: '1.7'
VersionChanged: '1.8'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
RSpec/MessageSpies:
@ -314,58 +371,70 @@ RSpec/MessageSpies:
SupportedStyles:
- have_received
- receive
VersionAdded: '1.9'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
RSpec/MissingExampleGroupArgument:
Description: Checks that the first argument to an example group is not empty.
Enabled: true
VersionAdded: '1.28'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
RSpec/MultipleDescribes:
Description: Checks for multiple top level describes.
Enabled: true
VersionAdded: '1.0'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
RSpec/MultipleExpectations:
Description: Checks if examples contain too many `expect` calls.
Enabled: true
Max: 1
VersionAdded: '1.7'
VersionChanged: '1.21'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
RSpec/MultipleSubjects:
Description: Checks if an example group defines `subject` multiple times.
Enabled: true
VersionAdded: '1.16'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
RSpec/NamedSubject:
Description: Checks for explicitly referenced test subjects.
Enabled: true
IgnoreSharedExamples: true
VersionAdded: 1.5.3
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
RSpec/NestedGroups:
Description: Checks for nested example groups.
Enabled: true
Max: 3
VersionAdded: '1.7'
VersionChanged: '1.10'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
RSpec/NotToNot:
Description: Checks for consistent method usage for negating expectations.
Enabled: true
EnforcedStyle: not_to
SupportedStyles:
- not_to
- to_not
Enabled: true
VersionAdded: '1.4'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
RSpec/OverwritingSetup:
Enabled: true
Description: Checks if there is a let/subject that overwrites an existing one.
Enabled: true
VersionAdded: '1.14'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
RSpec/Pending:
Enabled: false
Description: Checks for any pending or skipped examples.
Enabled: false
VersionAdded: '1.25'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
RSpec/PredicateMatcher:
@ -377,109 +446,154 @@ RSpec/PredicateMatcher:
SupportedStyles:
- inflected
- explicit
SafeAutoCorrect: false
VersionAdded: '1.16'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
RSpec/ReceiveCounts:
Enabled: true
Description: Check for `once` and `twice` receive counts matchers usage.
Enabled: true
VersionAdded: '1.26'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
RSpec/ReceiveNever:
Enabled: true
Description: Prefer `not_to receive(...)` over `receive(...).never`.
Enabled: true
VersionAdded: '1.28'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
RSpec/RepeatedDescription:
Enabled: true
Description: Check for repeated description strings in example groups.
Enabled: true
VersionAdded: '1.9'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
RSpec/RepeatedExample:
Enabled: true
Description: Check for repeated examples within example groups.
Enabled: true
VersionAdded: '1.10'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
RSpec/RepeatedExampleGroupBody:
Enabled: true
Description: Check for repeated describe and context block body.
Enabled: true
VersionAdded: '1.38'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
RSpec/RepeatedExampleGroupDescription:
Enabled: true
Description: Check for repeated example group descriptions.
Enabled: true
VersionAdded: '1.38'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
RSpec/ReturnFromStub:
Enabled: true
Description: Checks for consistent style of stub's return setting.
Enabled: true
EnforcedStyle: and_return
SupportedStyles:
- and_return
- block
VersionAdded: '1.16'
VersionChanged: '1.22'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
RSpec/ScatteredLet:
Description: Checks for let scattered across the example group.
Enabled: true
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
VersionAdded: '1.14'
VersionChanged: '1.39'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
RSpec/ScatteredSetup:
Description: Checks for setup scattered across multiple hooks in an example group.
Enabled: true
VersionAdded: '1.10'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
RSpec/SharedContext:
Description: Checks for proper shared_context and shared_examples usage.
Enabled: true
VersionAdded: '1.13'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
RSpec/SharedExamples:
Description: Enforces use of string to titleize shared examples.
Enabled: true
VersionAdded: '1.25'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
RSpec/SingleArgumentMessageChain:
Description: Checks that chains of messages contain more than one element.
Enabled: true
VersionAdded: '1.9'
VersionChanged: '1.10'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
RSpec/SubjectStub:
Description: Checks for stubbed test subjects.
Enabled: true
VersionAdded: '1.7'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
RSpec/UnspecifiedException:
Description: Checks for a specified error in checking raised errors.
Enabled: true
VersionAdded: '1.30'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
RSpec/VariableDefinition:
Description: Checks that memoized helpers names are symbols or strings.
Enabled: true
EnforcedStyle: symbols
SupportedStyles:
- symbols
- strings
VersionAdded: '1.40'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
RSpec/VariableName:
Description: Checks that memoized helper names use the configured style.
Enabled: true
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- camelCase
VersionAdded: '1.40'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
RSpec/VerifiedDoubles:
Description: Prefer using verifying doubles over normal doubles.
Enabled: true
IgnoreNameless: true
IgnoreSymbolicNames: false
VersionAdded: 1.2.1
VersionChanged: '1.5'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
RSpec/VoidExpect:
Description: This cop checks void `expect()`.
Enabled: true
VersionAdded: '1.16'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
RSpec/Yield:
Description: This cop checks for calling a block within a stub.
Enabled: true
VersionAdded: '1.32'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
Capybara/CurrentPathExpectation:
Description: Checks that no expectations are set on Capybara's `current_path`.
Enabled: true
VersionAdded: '1.18'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
Capybara/FeatureMethods:
Description: Checks for consistent method usage in feature specs.
Enabled: true
EnabledMethods: []
VersionAdded: '1.17'
VersionChanged: '1.25'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
Capybara/VisibilityMatcher:
@ -491,6 +605,7 @@ Capybara/VisibilityMatcher:
FactoryBot/AttributeDefinedStatically:
Description: Always declare attribute values as blocks.
Enabled: true
VersionAdded: '1.28'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
FactoryBot/CreateList:
@ -500,11 +615,13 @@ FactoryBot/CreateList:
SupportedStyles:
- create_list
- n_times
VersionAdded: '1.25'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
FactoryBot/FactoryClassName:
Description: Use string value when setting the class attribute explicitly.
Enabled: true
VersionAdded: '1.37'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
Rails/HttpStatus:
@ -514,4 +631,5 @@ Rails/HttpStatus:
SupportedStyles:
- numeric
- symbolic
VersionAdded: '1.23'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus

View File

@ -17,6 +17,7 @@ require_relative 'rubocop/rspec/concept'
require_relative 'rubocop/rspec/example_group'
require_relative 'rubocop/rspec/example'
require_relative 'rubocop/rspec/hook'
require_relative 'rubocop/rspec/variable'
require_relative 'rubocop/cop/rspec/cop'
require_relative 'rubocop/rspec/align_let_brace'
require_relative 'rubocop/rspec/factory_bot'

View File

@ -18,35 +18,50 @@ module RuboCop
#
# # bad
# expect(page).to have_selector('.foo', visible: false)
#
# # bad
# expect(page).to have_selector('.foo', visible: true)
#
# # good
# expect(page).to have_selector('.foo', visible: :all)
#
# # good
# expect(page).to have_selector('.foo', visible: :hidden)
# expect(page).to have_css('.foo', visible: true)
# expect(page).to have_link('my link', visible: false)
#
# # good
# expect(page).to have_selector('.foo', visible: :visible)
# expect(page).to have_css('.foo', visible: :all)
# expect(page).to have_link('my link', visible: :hidden)
#
class VisibilityMatcher < Cop
MSG_FALSE = 'Use `:all` or `:hidden` instead of `false`.'
MSG_TRUE = 'Use `:visible` instead of `true`.'
CAPYBARA_MATCHER_METHODS = %i[
have_selector
have_css
have_xpath
have_link
have_button
have_field
have_select
have_table
have_checked_field
have_unchecked_field
have_text
have_content
].freeze
def_node_matcher :visible_true?, <<~PATTERN
(send nil? :have_selector ... (hash <$(pair (sym :visible) true) ...>))
(send nil? #capybara_matcher? ... (hash <$(pair (sym :visible) true) ...>))
PATTERN
def_node_matcher :visible_false?, <<~PATTERN
(send nil? :have_selector ... (hash <$(pair (sym :visible) false) ...>))
(send nil? #capybara_matcher? ... (hash <$(pair (sym :visible) false) ...>))
PATTERN
def on_send(node)
visible_false?(node) { |arg| add_offense(arg, message: MSG_FALSE) }
visible_true?(node) { |arg| add_offense(arg, message: MSG_TRUE) }
end
private
def capybara_matcher?(method_name)
CAPYBARA_MATCHER_METHODS.include? method_name
end
end
end
end

View File

@ -2,28 +2,8 @@
module RuboCop
module Cop
WorkaroundCop = Cop.dup
# Clone of the the normal RuboCop::Cop::Cop class so we can rewrite
# the inherited method without breaking functionality
class WorkaroundCop
# Remove the Cop.inherited method to be a noop. Our RSpec::Cop
# class will invoke the inherited hook instead
class << self
undef inherited
def inherited(*) end
end
# Special case `Module#<` so that the rspec support rubocop exports
# is compatible with our subclass
def self.<(other)
other.equal?(RuboCop::Cop::Cop) || super
end
end
private_constant(:WorkaroundCop)
module RSpec
# @abstract parent class to rspec cops
# @abstract parent class to RSpec cops
#
# The criteria for whether rubocop-rspec analyzes a certain ruby file
# is configured via `AllCops/RSpec`. For example, if you want to
@ -31,13 +11,13 @@ module RuboCop
# then you could add this to your configuration:
#
# @example configuring analyzed paths
#
# AllCops:
# RSpec:
# Patterns:
# - '_test.rb$'
# - '(?:^|/)test/'
class Cop < WorkaroundCop
# # .rubocop.yml
# # AllCops:
# # RSpec:
# # Patterns:
# # - '_test.rb$'
# # - '(?:^|/)test/'
class Cop < ::RuboCop::Cop::Cop
include RuboCop::RSpec::Language
include RuboCop::RSpec::Language::NodePattern

View File

@ -3,10 +3,11 @@
module RuboCop
module Cop
module RSpec
# Checks that spec file paths are consistent with the test subject.
# Checks that spec file paths are consistent and well-formed.
#
# Checks the path of the spec file and enforces that it reflects the
# described class/module and its optionally called out method.
# By default, this checks that spec file paths are consistent with the
# test subject and and enforces that it reflects the described
# class/module and its optionally called out method.
#
# With the configuration option `IgnoreMethods` the called out method will
# be ignored when determining the enforced path.
@ -15,6 +16,10 @@ module RuboCop
# be specified that should not as usual be transformed from CamelCase to
# snake_case (e.g. 'RuboCop' => 'rubocop' ).
#
# With the configuration option `SpecSuffixOnly` test files will only
# be checked to ensure they end in '_spec.rb'. This option disables
# checking for consistency in the test subject or test methods.
#
# @example
# # bad
# whatever_spec.rb # describe MyClass
@ -41,6 +46,16 @@ module RuboCop
# # good
# my_class_spec.rb # describe MyClass, '#method'
#
# @example when configuration is `SpecSuffixOnly: true`
# # good
# whatever_spec.rb # describe MyClass
#
# # good
# my_class_spec.rb # describe MyClass
#
# # good
# my_class_spec.rb # describe MyClass, '#method'
#
class FilePath < Cop
include RuboCop::RSpec::TopLevelDescribe
@ -70,9 +85,15 @@ module RuboCop
end
def glob_for((described_class, method_name))
return glob_for_spec_suffix_only? if spec_suffix_only?
"#{expected_path(described_class)}#{name_glob(method_name)}*_spec.rb"
end
def glob_for_spec_suffix_only?
'*_spec.rb'
end
def name_glob(name)
return unless name&.str_type?
@ -105,12 +126,17 @@ module RuboCop
def filename_ends_with?(glob)
filename =
RuboCop::PathUtil.relative_path(processed_source.buffer.name)
.gsub('../', '')
File.fnmatch?("*#{glob}", filename)
end
def relevant_rubocop_rspec_file?(_file)
true
end
def spec_suffix_only?
cop_config['SpecSuffixOnly']
end
end
end
end

View File

@ -70,6 +70,7 @@ module RuboCop
'to describe HTTP status code.'
attr_reader :node
def initialize(node)
@node = node
end
@ -110,6 +111,7 @@ module RuboCop
ALLOWED_STATUSES = %i[error success missing redirect].freeze
attr_reader :node
def initialize(node)
@node = node
end

View File

@ -34,6 +34,15 @@ module RuboCop
# it { cool_predicate }
# end
#
# # good
# context Array do
# it { is_expected.to respond_to :each }
# end
#
# context Hash do
# it { is_expected.to respond_to :each }
# end
#
class RepeatedExampleGroupBody < Cop
MSG = 'Repeated %<group>s block body on line(s) %<loc>s'
@ -43,6 +52,7 @@ module RuboCop
def_node_matcher :metadata, '(block (send _ _ _ $...) ...)'
def_node_matcher :body, '(block _ args $...)'
def_node_matcher :const_arg, '(block (send _ _ $const ...) ...)'
def_node_matcher :skip_or_pending?, <<-PATTERN
(block <(send nil? {:skip :pending}) ...>)
@ -75,7 +85,7 @@ module RuboCop
end
def signature_keys(group)
[metadata(group), body(group)]
[metadata(group), body(group), const_arg(group)]
end
def message(group, repeats)

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require 'set'
module RuboCop
module Cop
module RSpec
@ -75,70 +77,46 @@ module RuboCop
def on_block(node)
return unless example_group?(node)
return if (processed_example_groups & node.ancestors).any?
find_subject_stub(node) do |stub|
processed_example_groups << node
@explicit_subjects = find_all_explicit_subjects(node)
find_subject_expectations(node) do |stub|
add_offense(stub)
end
end
private
# Find subjects within tree and then find (send) nodes for that subject
#
# @param node [RuboCop::Node] example group
#
# @yield [RuboCop::Node] message expectations for subject
def find_subject_stub(node, &block)
find_subject(node) do |subject_name, context|
find_subject_expectation(context, subject_name, &block)
def processed_example_groups
@processed_example_groups ||= Set.new
end
def find_all_explicit_subjects(node)
node.each_descendant(:block).with_object({}) do |child, h|
name = subject(child)
next unless name
outer_example_group = child.each_ancestor.find do |a|
example_group?(a)
end
h[outer_example_group] ||= []
h[outer_example_group] << name
end
end
# Find a subject message expectation
#
# @param node [RuboCop::Node]
# @param subject_name [Symbol] name of subject
#
# @yield [RuboCop::Node] message expectation
def find_subject_expectation(node, subject_name, &block)
# Do not search node if it is an example group with its own subject.
return if example_group?(node) && redefines_subject?(node)
def find_subject_expectations(node, subject_names = [], &block)
subject_names = @explicit_subjects[node] if @explicit_subjects[node]
# Yield the current node if it is a message expectation.
yield(node) if message_expectation?(node, subject_name)
# Recurse through node's children looking for a message expectation.
node.each_child_node do |child|
find_subject_expectation(child, subject_name, &block)
expectation_detected = (subject_names + [:subject]).any? do |name|
message_expectation?(node, name)
end
end
# Check if node's children contain a subject definition
#
# @param node [RuboCop::Node]
#
# @return [Boolean]
def redefines_subject?(node)
node.each_child_node.any? do |child|
subject(child) || redefines_subject?(child)
end
end
# Find a subject definition
#
# @param node [RuboCop::Node]
# @param parent [RuboCop::Node,nil]
#
# @yieldparam subject_name [Symbol] name of subject being defined
# @yieldparam parent [RuboCop::Node] parent of subject definition
def find_subject(node, parent: nil, &block)
# An implicit subject is defined by RSpec when no subject is declared
subject_name = subject(node) || :subject
yield(subject_name, parent) if parent
return yield(node) if expectation_detected
node.each_child_node do |child|
find_subject(child, parent: node, &block)
find_subject_expectations(child, subject_names, &block)
end
end
end

View File

@ -0,0 +1,56 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Checks that memoized helpers names are symbols or strings.
#
# @example EnforcedStyle: symbols (default)
# # bad
# let('user_name') { 'Adam' }
# subject('user') { create_user }
#
# # good
# let(:user_name) { 'Adam' }
# subject(:user) { create_user }
#
# @example EnforcedStyle: strings
# # bad
# let(:user_name) { 'Adam' }
# subject(:user) { create_user }
#
# # good
# let('user_name') { 'Adam' }
# subject('user') { create_user }
class VariableDefinition < Cop
include ConfigurableEnforcedStyle
include RuboCop::RSpec::Variable
MSG = 'Use %<style>s for variable names.'
def on_send(node)
variable_definition?(node) do |variable|
if style_violation?(variable)
add_offense(variable, message: format(MSG, style: style))
end
end
end
private
def style_violation?(variable)
style == :symbols && string?(variable) ||
style == :strings && symbol?(variable)
end
def string?(node)
node.str_type? || node.dstr_type?
end
def symbol?(node)
node.sym_type? || node.dsym_type?
end
end
end
end
end

View File

@ -0,0 +1,47 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Checks that memoized helper names use the configured style.
#
# @example EnforcedStyle: snake_case (default)
# # bad
# let(:userName) { 'Adam' }
# subject(:userName) { 'Adam' }
#
# # good
# let(:user_name) { 'Adam' }
# subject(:user_name) { 'Adam' }
#
# @example EnforcedStyle: camelCase
# # bad
# let(:user_name) { 'Adam' }
# subject(:user_name) { 'Adam' }
#
# # good
# let(:userName) { 'Adam' }
# subject(:userName) { 'Adam' }
class VariableName < Cop
include ConfigurableNaming
include RuboCop::RSpec::Variable
MSG = 'Use %<style>s for variable names.'
def on_send(node)
variable_definition?(node) do |variable|
return if variable.dstr_type? || variable.dsym_type?
check_name(node, variable.value, variable.loc.expression)
end
end
private
def message(style)
format(MSG, style: style)
end
end
end
end
end

View File

@ -86,6 +86,8 @@ require_relative 'rspec/shared_examples'
require_relative 'rspec/single_argument_message_chain'
require_relative 'rspec/subject_stub'
require_relative 'rspec/unspecified_exception'
require_relative 'rspec/variable_definition'
require_relative 'rspec/variable_name'
require_relative 'rspec/verified_doubles'
require_relative 'rspec/void_expect'
require_relative 'rspec/yield'

View File

@ -21,7 +21,7 @@ module RuboCop
# Decorator of a YARD code object for working with documented rspec cops
class CodeObject
COP_CLASS_NAMES = %w[RuboCop::Cop RuboCop::Cop::RSpec::Cop].freeze
COP_CLASS_NAME = 'RuboCop::Cop::RSpec::Cop'
RSPEC_NAMESPACE = 'RuboCop::Cop::RSpec'
def initialize(yardoc)
@ -68,11 +68,7 @@ module RuboCop
end
def cop_subclass?
# YARD superclass resolution is a bit flaky: All classes loaded before
# RuboCop::Cop::WorkaroundCop are shown as having RuboCop::Cop as
# superclass, while all the following classes are listed as having
# RuboCop::Cop::RSpec::Cop as their superclass.
COP_CLASS_NAMES.include?(yardoc.superclass.path)
yardoc.superclass.path == COP_CLASS_NAME
end
def abstract?

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