Skip to content

Commit

Permalink
Expose 'with default RSpec/Language config' to consumers
Browse files Browse the repository at this point in the history
This helper is essential for anyone writing their own RSpec cops based
on `RuboCop::Cop::RSpec::Base`, because it now requires a minimal config
to even run the cop.

The wordy file name is because the RuboCop gem already defines
`rubocop/rspec/shared_contexts`, and we don't want to shadow that. This
means that consumers of this library who want to write a spec for a cop
based on `RuboCop::Cop::RSpec::Base` will need something like this in
`spec/spec_helper.rb`:

require 'rubocop/rspec/shared_contexts/default_rspec_language_config_context'

RSpec.config do |config|
  # ...
  # Add metadata as appropriate
  config.include_context 'with default RSpec/Language config'
end
  • Loading branch information
smcgivern committed Oct 26, 2022
1 parent b7a15f7 commit 48e0f61
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
- Do not attempt to auto-correct example groups with `include_examples` in `RSpec/LetBeforeExamples`. ([@pirj])
- Add new `RSpec/SortMetadata` cop. ([@leoarnold])
- Add support for subject! method to `RSpec/SubjectDeclaration`. ([@ydah])
* Add `require_implicit` style to `RSpec/ImplicitSubject`. ([@r7kamura][])
* Fix a false positive for `RSpec/Capybara/SpecificMatcher` when `have_css("a")` without attribute. ([@ydah][])
* Add `with default RSpec/Language config` helper to `lib` (under `rubocop/rspec/shared_contexts/default_rspec_language_config_context`), to allow use for downstream cops based on `RuboCop::Cop::RSpec::Base`. ([@smcgivern][])

## 2.13.2 (2022-09-23)

Expand Down

0 comments on commit 48e0f61

Please sign in to comment.