Merge pull request #6774 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rspec-1.37.0

build: bump rubocop-rspec from 1.36.0 to 1.37.0 in /Library/Homebrew
This commit is contained in:
Mike McQuaid 2019-11-27 13:58:40 +00:00 committed by GitHub
commit 9aa42f081b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
105 changed files with 189 additions and 92 deletions

View File

@ -74,7 +74,7 @@ jobs:
- name: Run brew style - name: Run brew style
run: | run: |
export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin" export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin"
brew style brew style --display-cop-names
- name: Run brew man - name: Run brew man
run: | run: |

View File

@ -14,6 +14,8 @@ RSpec/AnyInstance:
Enabled: false Enabled: false
RSpec/ImplicitBlockExpectation: RSpec/ImplicitBlockExpectation:
Enabled: false Enabled: false
RSpec/SubjectStub:
Enabled: false
# TODO: try to enable these (also requires fixing Homebrew/bundle) # TODO: try to enable these (also requires fixing Homebrew/bundle)
RSpec/ContextWording: RSpec/ContextWording:

View File

@ -89,7 +89,7 @@ GEM
unicode-display_width (>= 1.4.0, < 1.7) unicode-display_width (>= 1.4.0, < 1.7)
rubocop-performance (1.5.1) rubocop-performance (1.5.1)
rubocop (>= 0.71.0) rubocop (>= 0.71.0)
rubocop-rspec (1.36.0) rubocop-rspec (1.37.0)
rubocop (>= 0.68.1) rubocop (>= 0.68.1)
ruby-macho (2.2.0) ruby-macho (2.2.0)
ruby-progressbar (1.10.1) ruby-progressbar (1.10.1)

View File

@ -43,7 +43,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ntlm-http-0.1.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/webrobots-0.1.2/lib" $:.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/mechanize-2.7.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mustache-1.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mustache-1.1.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.19.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.19.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-2.29.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-2.29.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.6.5.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.6.5.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib"
@ -57,11 +57,11 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-expectations-3.
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-mocks-3.9.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-mocks-3.9.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-3.9.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-3.9.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-its-1.3.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-its-1.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-retry-0.6.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-retry-0.6.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/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.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.76.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.76.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.36.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.37.0/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"

View File

@ -13,32 +13,32 @@ AllCops:
RSpec/AlignLeftLetBrace: RSpec/AlignLeftLetBrace:
Description: Checks that left braces for adjacent single line lets are aligned. Description: Checks that left braces for adjacent single line lets are aligned.
Enabled: false Enabled: false
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
RSpec/AlignRightLetBrace: RSpec/AlignRightLetBrace:
Description: Checks that right braces for adjacent single line lets are aligned. Description: Checks that right braces for adjacent single line lets are aligned.
Enabled: false Enabled: false
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
RSpec/AnyInstance: RSpec/AnyInstance:
Description: Check that instances are not being stubbed globally. Description: Check that instances are not being stubbed globally.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
RSpec/AroundBlock: RSpec/AroundBlock:
Description: Checks that around blocks actually run the test. Description: Checks that around blocks actually run the test.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
RSpec/Be: RSpec/Be:
Description: Check for expectations where `be` is used without argument. Description: Check for expectations where `be` is used without argument.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
RSpec/BeEql: RSpec/BeEql:
Description: Check for expectations where `be(...)` can replace `eql(...)`. Description: Check for expectations where `be(...)` can replace `eql(...)`.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
RSpec/BeforeAfterAll: RSpec/BeforeAfterAll:
Description: Check that before/after(:all) isn't being used. Description: Check that before/after(:all) isn't being used.
@ -47,12 +47,12 @@ RSpec/BeforeAfterAll:
- spec/spec_helper.rb - spec/spec_helper.rb
- spec/rails_helper.rb - spec/rails_helper.rb
- spec/support/**/*.rb - spec/support/**/*.rb
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
RSpec/ContextMethod: RSpec/ContextMethod:
Description: "`context` should not be used for specifying methods." Description: "`context` should not be used for specifying methods."
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
RSpec/ContextWording: RSpec/ContextWording:
Description: Checks that `context` docstring starts with an allowed prefix. Description: Checks that `context` docstring starts with an allowed prefix.
@ -61,22 +61,22 @@ RSpec/ContextWording:
- when - when
- with - with
- without - without
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
RSpec/DescribeClass: RSpec/DescribeClass:
Description: Check that the first argument to the top level describe is a constant. Description: Check that the first argument to the top level describe is a constant.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
RSpec/DescribeMethod: RSpec/DescribeMethod:
Description: Checks that the second argument to `describe` specifies a method. Description: Checks that the second argument to `describe` specifies a method.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
RSpec/DescribeSymbol: RSpec/DescribeSymbol:
Description: Avoid describing symbols. Description: Avoid describing symbols.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
RSpec/DescribedClass: RSpec/DescribedClass:
Description: Checks that tests use `described_class`. Description: Checks that tests use `described_class`.
@ -86,51 +86,56 @@ RSpec/DescribedClass:
SupportedStyles: SupportedStyles:
- described_class - described_class
- explicit - explicit
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass 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
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
RSpec/Dialect: RSpec/Dialect:
Description: This cop enforces custom RSpec dialects. Description: This cop enforces custom RSpec dialects.
Enabled: false Enabled: false
PreferredMethods: {} PreferredMethods: {}
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
RSpec/EmptyExampleGroup: RSpec/EmptyExampleGroup:
Description: Checks if an example group does not include any tests. Description: Checks if an example group does not include any tests.
Enabled: true Enabled: true
CustomIncludeMethods: [] CustomIncludeMethods: []
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
RSpec/EmptyLineAfterExample: RSpec/EmptyLineAfterExample:
Description: Checks if there is an empty line after example blocks. Description: Checks if there is an empty line after example blocks.
Enabled: true Enabled: true
AllowConsecutiveOneLiners: true AllowConsecutiveOneLiners: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
RSpec/EmptyLineAfterExampleGroup: RSpec/EmptyLineAfterExampleGroup:
Description: Checks if there is an empty line after example group blocks. Description: Checks if there is an empty line after example group blocks.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
RSpec/EmptyLineAfterFinalLet: RSpec/EmptyLineAfterFinalLet:
Description: Checks if there is an empty line after the last let block. Description: Checks if there is an empty line after the last let block.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
RSpec/EmptyLineAfterHook: RSpec/EmptyLineAfterHook:
Description: Checks if there is an empty line after hook blocks. Description: Checks if there is an empty line after hook blocks.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
RSpec/EmptyLineAfterSubject: RSpec/EmptyLineAfterSubject:
Description: Checks if there is an empty line after subject block. Description: Checks if there is an empty line after subject block.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
RSpec/ExampleLength: RSpec/ExampleLength:
Description: Checks for long examples. Description: Checks for long examples.
Enabled: true Enabled: true
Max: 5 Max: 5
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
RSpec/ExampleWithoutDescription: RSpec/ExampleWithoutDescription:
Description: Checks for examples without a description. Description: Checks for examples without a description.
@ -140,7 +145,7 @@ RSpec/ExampleWithoutDescription:
- always_allow - always_allow
- single_line_only - single_line_only
- disallow - disallow
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
RSpec/ExampleWording: RSpec/ExampleWording:
Description: Checks for common mistakes in example descriptions. Description: Checks for common mistakes in example descriptions.
@ -151,14 +156,14 @@ RSpec/ExampleWording:
have: has have: has
HAVE: HAS HAVE: HAS
IgnoredWords: [] IgnoredWords: []
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
RSpec/ExpectActual: RSpec/ExpectActual:
Description: Checks for `expect(...)` calls containing literal values. Description: Checks for `expect(...)` calls containing literal values.
Enabled: true Enabled: true
Exclude: Exclude:
- spec/routing/**/* - spec/routing/**/*
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
RSpec/ExpectChange: RSpec/ExpectChange:
Description: Checks for consistent style of change matcher. Description: Checks for consistent style of change matcher.
@ -167,17 +172,17 @@ RSpec/ExpectChange:
SupportedStyles: SupportedStyles:
- method_call - method_call
- block - block
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
RSpec/ExpectInHook: RSpec/ExpectInHook:
Enabled: true Enabled: true
Description: Do not use `expect` in hooks such as `before`. Description: Do not use `expect` in hooks such as `before`.
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
RSpec/ExpectOutput: RSpec/ExpectOutput:
Description: Checks for opportunities to use `expect { ... }.to output`. Description: Checks for opportunities to use `expect { ... }.to output`.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
RSpec/FilePath: RSpec/FilePath:
Description: Checks that spec file paths are consistent with the test subject. Description: Checks that spec file paths are consistent with the test subject.
@ -186,12 +191,12 @@ RSpec/FilePath:
RuboCop: rubocop RuboCop: rubocop
RSpec: rspec RSpec: rspec
IgnoreMethods: false IgnoreMethods: false
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
RSpec/Focus: RSpec/Focus:
Description: Checks if examples are focused. Description: Checks if examples are focused.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
RSpec/HookArgument: RSpec/HookArgument:
Description: Checks the arguments passed to `before`, `around`, and `after`. Description: Checks the arguments passed to `before`, `around`, and `after`.
@ -201,17 +206,17 @@ RSpec/HookArgument:
- implicit - implicit
- each - each
- example - example
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
RSpec/HooksBeforeExamples: RSpec/HooksBeforeExamples:
Enabled: true Enabled: true
Description: Checks for before/around/after hooks that come after an example. Description: Checks for before/around/after hooks that come after an example.
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
RSpec/ImplicitBlockExpectation: RSpec/ImplicitBlockExpectation:
Description: Check that implicit block expectation syntax is not used. Description: Check that implicit block expectation syntax is not used.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
RSpec/ImplicitExpect: RSpec/ImplicitExpect:
Description: Check that a consistent implicit expectation style is used. Description: Check that a consistent implicit expectation style is used.
@ -220,7 +225,7 @@ RSpec/ImplicitExpect:
SupportedStyles: SupportedStyles:
- is_expected - is_expected
- should - should
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
RSpec/ImplicitSubject: RSpec/ImplicitSubject:
Enabled: true Enabled: true
@ -230,23 +235,23 @@ RSpec/ImplicitSubject:
- single_line_only - single_line_only
- single_statement_only - single_statement_only
- disallow - disallow
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
RSpec/InstanceSpy: RSpec/InstanceSpy:
Description: Checks for `instance_double` used with `have_received`. Description: Checks for `instance_double` used with `have_received`.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
RSpec/InstanceVariable: RSpec/InstanceVariable:
Description: Checks for instance variable usage in specs. Description: Checks for instance variable usage in specs.
AssignmentOnly: false AssignmentOnly: false
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
RSpec/InvalidPredicateMatcher: RSpec/InvalidPredicateMatcher:
Description: Checks invalid usage for predicate matcher. Description: Checks invalid usage for predicate matcher.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InvalidPredicateMatcher StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InvalidPredicateMatcher
RSpec/ItBehavesLike: RSpec/ItBehavesLike:
Description: Checks that only one `it_behaves_like` style is used. Description: Checks that only one `it_behaves_like` style is used.
@ -255,37 +260,37 @@ RSpec/ItBehavesLike:
SupportedStyles: SupportedStyles:
- it_behaves_like - it_behaves_like
- it_should_behave_like - it_should_behave_like
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
RSpec/IteratedExpectation: RSpec/IteratedExpectation:
Description: Check that `all` matcher is used instead of iterating over an array. Description: Check that `all` matcher is used instead of iterating over an array.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
RSpec/LeadingSubject: RSpec/LeadingSubject:
Description: Enforce that subject is the first definition in the test. Description: Enforce that subject is the first definition in the test.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
RSpec/LeakyConstantDeclaration: RSpec/LeakyConstantDeclaration:
Description: Checks that no class, module, or constant is declared. Description: Checks that no class, module, or constant is declared.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
RSpec/LetBeforeExamples: RSpec/LetBeforeExamples:
Description: Checks for `let` definitions that come after an example. Description: Checks for `let` definitions that come after an example.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
RSpec/LetSetup: RSpec/LetSetup:
Description: Checks unreferenced `let!` calls being used for test setup. Description: Checks unreferenced `let!` calls being used for test setup.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
RSpec/MessageChain: RSpec/MessageChain:
Description: Check that chains of messages are not being stubbed. Description: Check that chains of messages are not being stubbed.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
RSpec/MessageExpectation: RSpec/MessageExpectation:
Description: Checks for consistent message expectation style. Description: Checks for consistent message expectation style.
@ -294,7 +299,7 @@ RSpec/MessageExpectation:
SupportedStyles: SupportedStyles:
- allow - allow
- expect - expect
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
RSpec/MessageSpies: RSpec/MessageSpies:
Description: Checks that message expectations are set using spies. Description: Checks that message expectations are set using spies.
@ -303,41 +308,41 @@ RSpec/MessageSpies:
SupportedStyles: SupportedStyles:
- have_received - have_received
- receive - receive
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
RSpec/MissingExampleGroupArgument: RSpec/MissingExampleGroupArgument:
Description: Checks that the first argument to an example group is not empty. Description: Checks that the first argument to an example group is not empty.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
RSpec/MultipleDescribes: RSpec/MultipleDescribes:
Description: Checks for multiple top level describes. Description: Checks for multiple top level describes.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
RSpec/MultipleExpectations: RSpec/MultipleExpectations:
Description: Checks if examples contain too many `expect` calls. Description: Checks if examples contain too many `expect` calls.
Enabled: true Enabled: true
Max: 1 Max: 1
AggregateFailuresByDefault: false AggregateFailuresByDefault: false
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
RSpec/MultipleSubjects: RSpec/MultipleSubjects:
Description: Checks if an example group defines `subject` multiple times. Description: Checks if an example group defines `subject` multiple times.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
RSpec/NamedSubject: RSpec/NamedSubject:
Description: Checks for explicitly referenced test subjects. Description: Checks for explicitly referenced test subjects.
Enabled: true Enabled: true
IgnoreSharedExamples: true IgnoreSharedExamples: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
RSpec/NestedGroups: RSpec/NestedGroups:
Description: Checks for nested example groups. Description: Checks for nested example groups.
Enabled: true Enabled: true
Max: 3 Max: 3
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
RSpec/NotToNot: RSpec/NotToNot:
Description: Checks for consistent method usage for negating expectations. Description: Checks for consistent method usage for negating expectations.
@ -346,47 +351,48 @@ RSpec/NotToNot:
- not_to - not_to
- to_not - to_not
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
RSpec/OverwritingSetup: RSpec/OverwritingSetup:
Enabled: true Enabled: true
Description: Checks if there is a let/subject that overwrites an existing one. Description: Checks if there is a let/subject that overwrites an existing one.
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
RSpec/Pending: RSpec/Pending:
Enabled: false Enabled: false
Description: Checks for any pending or skipped examples. Description: Checks for any pending or skipped examples.
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
RSpec/PredicateMatcher: RSpec/PredicateMatcher:
Description: Prefer using predicate matcher over using predicate method directly. Description: Prefer using predicate matcher over using predicate method directly.
Enabled: true Enabled: true
Strict: true Strict: true
EnforcedStyle: inflected EnforcedStyle: inflected
AllowedExplicitMatchers: []
SupportedStyles: SupportedStyles:
- inflected - inflected
- explicit - explicit
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
RSpec/ReceiveCounts: RSpec/ReceiveCounts:
Enabled: true Enabled: true
Description: Check for `once` and `twice` receive counts matchers usage. Description: Check for `once` and `twice` receive counts matchers usage.
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
RSpec/ReceiveNever: RSpec/ReceiveNever:
Enabled: true Enabled: true
Description: Prefer `not_to receive(...)` over `receive(...).never`. Description: Prefer `not_to receive(...)` over `receive(...).never`.
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
RSpec/RepeatedDescription: RSpec/RepeatedDescription:
Enabled: true Enabled: true
Description: Check for repeated description strings in example groups. Description: Check for repeated description strings in example groups.
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
RSpec/RepeatedExample: RSpec/RepeatedExample:
Enabled: true Enabled: true
Description: Check for repeated examples within example groups. Description: Check for repeated examples within example groups.
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
RSpec/ReturnFromStub: RSpec/ReturnFromStub:
Enabled: true Enabled: true
@ -395,75 +401,75 @@ RSpec/ReturnFromStub:
SupportedStyles: SupportedStyles:
- and_return - and_return
- block - block
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
RSpec/ScatteredLet: RSpec/ScatteredLet:
Description: Checks for let scattered across the example group. Description: Checks for let scattered across the example group.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
RSpec/ScatteredSetup: RSpec/ScatteredSetup:
Description: Checks for setup scattered across multiple hooks in an example group. Description: Checks for setup scattered across multiple hooks in an example group.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
RSpec/SharedContext: RSpec/SharedContext:
Description: Checks for proper shared_context and shared_examples usage. Description: Checks for proper shared_context and shared_examples usage.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
RSpec/SharedExamples: RSpec/SharedExamples:
Description: Enforces use of string to titleize shared examples. Description: Enforces use of string to titleize shared examples.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
RSpec/SingleArgumentMessageChain: RSpec/SingleArgumentMessageChain:
Description: Checks that chains of messages contain more than one element. Description: Checks that chains of messages contain more than one element.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
RSpec/SubjectStub: RSpec/SubjectStub:
Description: Checks for stubbed test subjects. Description: Checks for stubbed test subjects.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
RSpec/UnspecifiedException: RSpec/UnspecifiedException:
Description: Checks for a specified error in checking raised errors. Description: Checks for a specified error in checking raised errors.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
RSpec/VerifiedDoubles: RSpec/VerifiedDoubles:
Description: Prefer using verifying doubles over normal doubles. Description: Prefer using verifying doubles over normal doubles.
Enabled: true Enabled: true
IgnoreNameless: true IgnoreNameless: true
IgnoreSymbolicNames: false IgnoreSymbolicNames: false
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
RSpec/VoidExpect: RSpec/VoidExpect:
Description: This cop checks void `expect()`. Description: This cop checks void `expect()`.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
RSpec/Yield: RSpec/Yield:
Description: This cop checks for calling a block within a stub. Description: This cop checks for calling a block within a stub.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
Capybara/CurrentPathExpectation: Capybara/CurrentPathExpectation:
Description: Checks that no expectations are set on Capybara's `current_path`. Description: Checks that no expectations are set on Capybara's `current_path`.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
Capybara/FeatureMethods: Capybara/FeatureMethods:
Description: Checks for consistent method usage in feature specs. Description: Checks for consistent method usage in feature specs.
Enabled: true Enabled: true
EnabledMethods: [] EnabledMethods: []
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
FactoryBot/AttributeDefinedStatically: FactoryBot/AttributeDefinedStatically:
Description: Always declare attribute values as blocks. Description: Always declare attribute values as blocks.
Enabled: true Enabled: true
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
FactoryBot/CreateList: FactoryBot/CreateList:
Description: Checks for create_list usage. Description: Checks for create_list usage.
@ -472,7 +478,12 @@ FactoryBot/CreateList:
SupportedStyles: SupportedStyles:
- create_list - create_list
- n_times - n_times
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList 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
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
Rails/HttpStatus: Rails/HttpStatus:
Description: Enforces use of symbolic or numeric value to describe HTTP status. Description: Enforces use of symbolic or numeric value to describe HTTP status.
@ -481,4 +492,4 @@ Rails/HttpStatus:
SupportedStyles: SupportedStyles:
- numeric - numeric
- symbolic - symbolic
StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus

View File

@ -6,7 +6,7 @@ module RuboCop
module Capybara module Capybara
# Checks that no expectations are set on Capybara's `current_path`. # Checks that no expectations are set on Capybara's `current_path`.
# #
# The `have_current_path` matcher (http://www.rubydoc.info/github/ # The `have_current_path` matcher (https://www.rubydoc.info/github/
# teamcapybara/capybara/master/Capybara/RSpecMatchers#have_current_path- # teamcapybara/capybara/master/Capybara/RSpecMatchers#have_current_path-
# instance_method) should be used on `page` to set expectations on # instance_method) should be used on `page` to set expectations on
# Capybara's current path, since it uses Capybara's waiting # Capybara's current path, since it uses Capybara's waiting

View File

@ -0,0 +1,36 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Avoid opening modules and defining specs within them.
#
# @example
# # bad
# module MyModule
# RSpec.describe MyClass do
# # ...
# end
# end
#
# # good
# RSpec.describe MyModule::MyClass do
# # ...
# end
#
# @see https://github.com/rubocop-hq/rubocop-rspec/issues/735
class DescribedClassModuleWrapping < Cop
MSG = 'Avoid opening modules and defining specs within them.'
def_node_search :find_rspec_blocks,
ExampleGroups::ALL.block_pattern
def on_module(node)
find_rspec_blocks(node) do
add_offense(node)
end
end
end
end
end
end

View File

@ -0,0 +1,39 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
module FactoryBot
# Use string value when setting the class attribute explicitly.
#
# @example
# # bad
# factory :foo, class: Foo do
# end
#
# # good
# factory :foo, class: 'Foo' do
# end
class FactoryClassName < Cop
MSG = "Pass '%<class_name>s' instead of %<class_name>s."
def_node_matcher :class_name, <<~PATTERN
(send _ :factory _ (hash <(pair (sym :class) $(const ...)) ...>))
PATTERN
def on_send(node)
class_name(node) do |cn|
add_offense(cn, message: format(MSG, class_name: cn.const_name))
end
end
def autocorrect(node)
lambda do |corrector|
corrector.replace(node.loc.expression, "'#{node.source}'")
end
end
end
end
end
end
end

View File

@ -82,7 +82,7 @@ module RuboCop
end end
end end
def is_expected_range(source_map) # rubocop:disable PredicateName def is_expected_range(source_map) # rubocop:disable Naming/PredicateName
Parser::Source::Range.new( Parser::Source::Range.new(
source_map.expression.source_buffer, source_map.expression.source_buffer,
source_map.expression.begin_pos, source_map.expression.begin_pos,

View File

@ -42,7 +42,7 @@ module RuboCop
def_node_matcher :skipped_in_metadata?, <<-PATTERN def_node_matcher :skipped_in_metadata?, <<-PATTERN
{ {
(send _ _ <#skip_or_pending? ...>) (send _ _ <#skip_or_pending? ...>)
(send _ _ ... (hash <(pair #skip_or_pending? true) ...>)) (send _ _ ... (hash <(pair #skip_or_pending? { true str }) ...>))
} }
PATTERN PATTERN

View File

@ -138,6 +138,10 @@ module RuboCop
private private
def allowed_explicit_matchers
cop_config.fetch('AllowedExplicitMatchers', []) + BUILT_IN_MATCHERS
end
def check_explicit(node) # rubocop:disable Metrics/MethodLength def check_explicit(node) # rubocop:disable Metrics/MethodLength
predicate_matcher_block?(node) do |_actual, matcher| predicate_matcher_block?(node) do |_actual, matcher|
add_offense( add_offense(
@ -178,7 +182,7 @@ module RuboCop
def predicate_matcher_name?(name) def predicate_matcher_name?(name)
name = name.to_s name = name.to_s
return false if BUILT_IN_MATCHERS.include?(name) return false if allowed_explicit_matchers.include?(name)
name.start_with?('be_', 'have_') && !name.end_with?('?') name.start_with?('be_', 'have_') && !name.end_with?('?')
end end

View File

@ -107,7 +107,7 @@ module RuboCop
MSG = 'Prefer `%<prefer>s` over `%<current>s` ' \ MSG = 'Prefer `%<prefer>s` over `%<current>s` ' \
'to describe HTTP status code.' 'to describe HTTP status code.'
WHITELIST_STATUS = %i[error success missing redirect].freeze ALLOWED_STATUSES = %i[error success missing redirect].freeze
attr_reader :node attr_reader :node
def initialize(node) def initialize(node)
@ -115,7 +115,7 @@ module RuboCop
end end
def offensive? def offensive?
!node.int_type? && !whitelisted_symbol? !node.int_type? && !allowed_symbol?
end end
def message def message
@ -136,8 +136,8 @@ module RuboCop
node.value node.value
end end
def whitelisted_symbol? def allowed_symbol?
node.sym_type? && WHITELIST_STATUS.include?(node.value) node.sym_type? && ALLOWED_STATUSES.include?(node.value)
end end
end end
end end

View File

@ -132,7 +132,10 @@ module RuboCop
# @yieldparam subject_name [Symbol] name of subject being defined # @yieldparam subject_name [Symbol] name of subject being defined
# @yieldparam parent [RuboCop::Node] parent of subject definition # @yieldparam parent [RuboCop::Node] parent of subject definition
def find_subject(node, parent: nil, &block) def find_subject(node, parent: nil, &block)
subject(node) { |name| yield(name, parent) } # An implicit subject is defined by RSpec when no subject is declared
subject_name = subject(node) || :subject
yield(subject_name, parent) if parent
node.each_child_node do |child| node.each_child_node do |child|
find_subject(child, parent: node, &block) find_subject(child, parent: node, &block)

View File

@ -5,6 +5,7 @@ require_relative 'rspec/capybara/feature_methods'
require_relative 'rspec/factory_bot/attribute_defined_statically' require_relative 'rspec/factory_bot/attribute_defined_statically'
require_relative 'rspec/factory_bot/create_list' require_relative 'rspec/factory_bot/create_list'
require_relative 'rspec/factory_bot/factory_class_name'
begin begin
require_relative 'rspec/rails/http_status' require_relative 'rspec/rails/http_status'
@ -25,6 +26,7 @@ require_relative 'rspec/describe_class'
require_relative 'rspec/describe_method' require_relative 'rspec/describe_method'
require_relative 'rspec/describe_symbol' require_relative 'rspec/describe_symbol'
require_relative 'rspec/described_class' require_relative 'rspec/described_class'
require_relative 'rspec/described_class_module_wrapping'
require_relative 'rspec/dialect' require_relative 'rspec/dialect'
require_relative 'rspec/empty_example_group' require_relative 'rspec/empty_example_group'
require_relative 'rspec/empty_line_after_example' require_relative 'rspec/empty_line_after_example'

View File

@ -7,7 +7,7 @@ module RuboCop
# Builds a YAML config file from two config hashes # Builds a YAML config file from two config hashes
class ConfigFormatter class ConfigFormatter
NAMESPACES = /^(RSpec|Capybara|FactoryBot|Rails)/.freeze NAMESPACES = /^(RSpec|Capybara|FactoryBot|Rails)/.freeze
STYLE_GUIDE_BASE_URL = 'http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/' STYLE_GUIDE_BASE_URL = 'https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/'
def initialize(config, descriptions) def initialize(config, descriptions)
@config = config @config = config

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