-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Expose 'with default RSpec/Language config' to consumers #1377
Conversation
I'd like to do this, but I wasn't sure where. Maybe https://github.com/rubocop/rubocop-rspec/blob/master/docs/modules/ROOT/pages/upgrade_to_version_2.adoc? |
I tested this on a library we have that uses rubocop-rspec and it worked for me: https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/119#note_1092839680 |
Yes, or add a section similar to RuboCop's https://docs.rubocop.org/rubocop/development.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Appreciate if you could add some docs.
f7e2dc5
to
ad674c8
Compare
Thanks @pirj, I added some brief development documentation. (Rendered: https://github.com/smcgivern/rubocop-rspec/blob/ad674c8ee2a55a48f933a4605d9145daaa83c7ba/docs/modules/ROOT/pages/development.adoc) I am not sure what the documentation guidelines are here, so I'm happy to take any and all suggestions there. |
I have renamed some of the required CI checks, which unfortunately means that you will need to rebase this branch to make CI pass. |
ad674c8
to
b98ecc2
Compare
Thanks, done. |
b98ecc2
to
b610cea
Compare
Rebased and moved the changelist item up to the master section. |
Fixes #1418, sorry I hadn't look before opening that issue, and thans for adding this support |
b610cea
to
8a21113
Compare
I tried using this branch of Otherwise it seems that the CI got stuck here, maybe you can try rebasing on top of master to re-trigger it? |
8a21113
to
48e0f61
Compare
@tdeo thanks for trying it out! I rebased because the CHANGELOG had conflicts, but the workflows need a maintainer to approve before they run: |
Green! |
c0f32a8
to
46a3019
Compare
@smcgivern May I ask you to rebase and make sure Changelog is in order? |
46a3019
to
2291b84
Compare
d5c9ae0
to
5335df3
Compare
@pirj sorry for the push spam, I didn't fix the CHANGELOG properly first time around. This is up to date now. |
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
5335df3
to
81c9faa
Compare
Thank you, @smcgivern ! |
Thanks @pirj! I look forward to deleting this file from our repos when this is release 😃 |
Released in 2.15.0, @smcgivern |
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 onRuboCop::Cop::RSpec::Base
will need something like this inspec/spec_helper.rb
:This was suggested in the PR that introduced this feature: https://github.com/rubocop/rubocop-rspec/pull/956/files#r515643915
fixes #1418
Before submitting the PR make sure the following are checked:
master
(if not - rebase it).CHANGELOG.md
if the new code introduces user-observable changes.bundle exec rake
) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).