-
-
Notifications
You must be signed in to change notification settings - Fork 285
Add an RSpec 4 pre-release CI job #1322
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
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
This comment was marked as resolved.
This comment was marked as resolved.
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
|
|
||
| it_behaves_like :something | ||
| it_should_behave_like :something | ||
| it_should_behave_like :something if RSpec::Core::Version::STRING < '4.0' |
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.
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
left a comment
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.
Fine by me.
Perhaps add a link to the RSpec 4 changelogs?
@bquorning Do you mean in code comments somewhere? I've added them to the commit message. |
| @@ -1,3 +1,2 @@ | |||
| --require spec_helper | |||
| --color | |||
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.
| config.filter_run focus: true | ||
| config.run_all_when_everything_filtered = true |
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.
| config.run_all_when_everything_filtered = true | ||
|
|
||
| # Forbid RSpec from monkey patching any of our objects | ||
| config.disable_monkey_patching! |
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.
| config.include(ExpectOffense) | ||
|
|
||
| config.include_context 'with default RSpec/Language config', :config | ||
| config.include_context 'config', :config |
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.
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.
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.