Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose 'with default RSpec/Language config' to consumers #1377

Merged

Commits on Nov 3, 2022

  1. Expose 'with default RSpec/Language config' to consumers

    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 to ensure this only happens for RSpec
      # cop specs
      config.include_context 'with default RSpec/Language config'
    end
    smcgivern committed Nov 3, 2022
    Configuration menu
    Copy the full SHA
    81c9faa View commit details
    Browse the repository at this point in the history