Merged
Conversation
A similar (unmerged) `rspec-support` PR rspec/rspec-support#517 Reasoning (https://bundler.io/v2.2/man/gemfile.5.html#GEMSPEC): > The .gemspec file is ... where you specify the dependencies your gem needs *to run*. Even though it contradicts the very existence of add_development_dependency. Discussions: - ruby/rubygems#5065 - ruby/rubygems#1104
pirj
commented
Jul 8, 2022
This comment was marked as resolved.
This comment was marked as resolved.
bquorning
reviewed
Jul 8, 2022
3b1d588 to
76bbe70
Compare
Starting from RSpec 4, the implicit shared context inclusion, when a shared context would have been included to an example if the example has matching metadata, is not the case anymore. See: - rspec/rspec-core#2834 - rspec/rspec-core#2832 - rspec/rspec-core#2878
76bbe70 to
c92d184
Compare
RSpec 4 will eventually be released. Since we're checking its style, why don't we add a job to use it to run our specs. This will help a bit to test RSpec 4 out.
c92d184 to
a004d11
Compare
pirj
commented
Jul 10, 2022
|
|
||
| it_behaves_like :something | ||
| it_should_behave_like :something | ||
| it_should_behave_like :something if RSpec::Core::Version::STRING < '4.0' |
Member
Author
There was a problem hiding this comment.
As we not only parse those weird specs, but also actually run them with rake spec, we have to conditionally call it_should_behave_like as this alias has been removed from RSpec 4.
bquorning
approved these changes
Jul 11, 2022
Collaborator
bquorning
left a comment
There was a problem hiding this comment.
Fine by me.
Perhaps add a link to the RSpec 4 changelogs?
Member
Author
@bquorning Do you mean in code comments somewhere? I've added them to the commit message. |
Merged
5 tasks
pirj
commented
Jul 11, 2022
| @@ -1,3 +1,2 @@ | |||
| --require spec_helper | |||
| --color | |||
Comment on lines
-27
to
-28
| config.filter_run focus: true | ||
| config.run_all_when_everything_filtered = true |
| config.run_all_when_everything_filtered = true | ||
|
|
||
| # Forbid RSpec from monkey patching any of our objects | ||
| config.disable_monkey_patching! |
| config.include(ExpectOffense) | ||
|
|
||
| config.include_context 'with default RSpec/Language config', :config | ||
| config.include_context 'config', :config |
Member
Author
There was a problem hiding this comment.
After this PR is merged (and released, and we bump our rubocop dependency, and we remove the :config from our 'with default RSpec/Language config' shared context), this line becomes redundant.
This was referenced Jul 22, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RSpec 4 will eventually be released. Since we're checking RSpec style, why don't we use RSpec 4 at least in an optional job to help test it out?
Below what had to be done.
Move dev dependencies to Gemfile
A similar (unmerged)
rspec-supportPR rspec/rspec-support#517Reasoning (https://bundler.io/v2.2/man/gemfile.5.html#GEMSPEC):
Even though it contradicts the very existence of add_development_dependency.
Discussions on this topic:
add_development_dependencyruby/rubygems#1104Refactored our CI workflow
Extracted
edgeRuboCop in separate job(s).RSpec 4
It's complicated and not an obvious situation with shared contexts.
Previously, they were auto-included using matching metadata. Now, only explicitly (see changes to the
spec/spec_helper.rb). This revealed two issues:shared_examples 'config', :config dowould be included first. Since we're overriding the one defined inrubocopwith ours, to setother_copswith a proper RSpec DSL configuration, there is only one way of doing that in a non-Yoda order as we have to do now:is to remove
:configfrom the definition inrubocop.But this makes it complicated, since well-known extensions depend on this metadata, and custom cops' specs, too.
This needs to be somehow fixed on RSpec 4 side.
config.include_examples. However,config.include_contextexists, and it's an alias that has different semantics but identical behaviour.