-
-
Notifications
You must be signed in to change notification settings - Fork 753
Shared example group inclusion changes #2256
Conversation
Previously, if you did `config.include :not_a_module, :some_meta`, and defined an example with `:some_meta` metadata, the ruby type error would be raised when the example was being prepared to run, and would lead to other errors due to RSpec’s example setup and teardown not completing. It was quite confusing. Instead, we fail fast at the point of the mistake. Also, we apply this to `config.extend` and `config.prepend` for consistency.
f34c874
to
9139c61
Compare
This simplifies things, makes things more consistent, and prepares us to be able to better handle metadata as per discussion in #1790.
9139c61
to
6e5a48f
Compare
This ensures that if we need to re-configure a group hooks registration happens appropriately. Also, do the same for example configuration.
5ef3a63
to
0ddbd25
Compare
OK, @rspec/rspec -- I've taken this PR as far as I plan to take it. Can someone (or multiple people) review it please? I'd love to get this in RSpec 3.5. |
👍 |
05ca6bd
to
8bc35e5
Compare
- Takes care of preserving metadata inheritance. - Takes care of re-applying filtered config items like module inclusions and hooks. This is necessary for #1790.
Previously, it always triggered auto-inclusion based on matching metadata. The option allows you to opt-in to having it add the metadata to included groups and examples instead. - Closes #1790 (this is the last thing necessary for it). - Addresses #1762. - Addresses user confusion reported in: - rspec/rspec-rails#1241 - rspec/rspec-rails#1579
8bc35e5
to
3589ab5
Compare
...and now this is green. @samphippen: is your 👍 a way of saying "LGTM" or just saying you're a fan of the feature as a whole? |
Yeah, It's an LGTM! Merge Away 😄 |
Haha...for such a large PR I was expecting more feedback :). One thing I'm not quite sure on is if the names I've chosen for things are best. Thoughts? |
I think the names are good, and you've done a good job of documenting them. With these things, we could agonise on the names, but I feel like they fill the purpose. I don't have anything obviously better. I did wonder why you didn't use a boolean initially, but I think using symbols is better :) |
Now that rspec/rspec-core#2256 has been merged.
@@ -24,7 +24,7 @@ Metrics/LineLength: | |||
|
|||
# This should go down over time. | |||
Metrics/MethodLength: | |||
Max: 40 | |||
Max: 37 |
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.
Woop :)
Now that rspec/rspec-core#2256 has been merged.
Shared example group inclusion changes
This is the start of a number of changes for #1790.
Still TODO:
RSpec.shared_examples
does.