Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Shared example group inclusion changes #2256

Merged
merged 8 commits into from
Jun 5, 2016
Merged

Shared example group inclusion changes #2256

merged 8 commits into from
Jun 5, 2016

Conversation

myronmarston
Copy link
Member

@myronmarston myronmarston commented Jun 2, 2016

This is the start of a number of changes for #1790.

Still TODO:

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.
@myronmarston myronmarston force-pushed the myron/fix-1790 branch 2 times, most recently from f34c874 to 9139c61 Compare June 3, 2016 04:27
This simplifies things, makes things more consistent,
and prepares us to be able to better handle metadata
as per discussion in #1790.
This ensures that if we need to re-configure a group hooks
registration happens appropriately.

Also, do the same for example configuration.
@myronmarston myronmarston force-pushed the myron/fix-1790 branch 7 times, most recently from 5ef3a63 to 0ddbd25 Compare June 5, 2016 07:37
@myronmarston myronmarston changed the title [WIP] Shared example group inclusion changes Shared example group inclusion changes Jun 5, 2016
@myronmarston
Copy link
Member Author

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.

@fables-tales
Copy link
Member

👍

- 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
@myronmarston
Copy link
Member Author

...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?

@fables-tales
Copy link
Member

Yeah, It's an LGTM! Merge Away 😄

@myronmarston
Copy link
Member Author

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?

@fables-tales
Copy link
Member

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 :)

@myronmarston myronmarston merged commit 76c706e into master Jun 5, 2016
@myronmarston myronmarston deleted the myron/fix-1790 branch June 5, 2016 17:07
myronmarston added a commit to rspec/rspec-support that referenced this pull request Jun 5, 2016
@@ -24,7 +24,7 @@ Metrics/LineLength:

# This should go down over time.
Metrics/MethodLength:
Max: 40
Max: 37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woop :)

JonRowe pushed a commit to rspec/rspec-support that referenced this pull request Jun 10, 2019
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
Shared example group inclusion changes
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants