Skip to content

RSpec/Language isn't merging properly #1126

@dvandersluis

Description

@dvandersluis

It appears that if values for RSpec/Language are being set in .rubocop.yml, they are clobbering the existing setup and this is causing quite a few other cops to fail due to RSpec syntax not being recognized.

With this minimal .rubocop.yml:

require:
  - rubocop-rspec

AllCops:
  TargetRubyVersion: 2.6

RSpec:
  Language:
    ExampleGroups:
      Regular:
        - endpoint
    Helpers:
      - set

I get the following in RuboCop::RSpec::Language.config:

{
  "ExampleGroups" => {
    "Regular" => ["endpoint"],
    "Skipped" => ["xdescribe", "xcontext", "xfeature"],
    "Focused" => ["fdescribe", "fcontext", "ffeature"]
  },
  "Examples" => {
    "Regular" => ["it", "specify", "example", "scenario", "its"],
    "Focused" => ["fit", "fspecify", "fexample", "fscenario", "focus"],
    "Skipped" => ["xit", "xspecify", "xexample", "xscenario", "skip"],
    "Pending" => ["pending"]
  },
  "Expectations" => ["expect", "is_expected", "expect_any_instance_of"],
  "Helpers" => ["set"],
  "Hooks" => ["prepend_before", "before", "append_before", "around", "prepend_after", "after", "append_after"],
  "HookScopes" => ["each", "example", "context", "all", "suite"],
  "Includes" => {
    "Examples" => ["it_behaves_like", "it_should_behave_like", "include_examples"],
    "Context" => ["include_context"]
  },
  "Runners" => ["to", "to_not", "not_to"],
  "SharedGroups" => {
    "Examples" => ["shared_examples", "shared_examples_for"],
    "Context" => ["shared_context"]
  },
  "Subjects" => ["subject", "subject!"]
}

You'll see that ExampleGroups/Regular and Helpers have been overridden to only be the values I specified. Am I missing something?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions