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

Hook refactoring plus suite hook fixes #1805

Merged
merged 8 commits into from
Dec 15, 2014

Conversation

myronmarston
Copy link
Member

This is some refactoring and improvements I had done during my initial implementation of #1749 but since that's not going to get merged soon I thought it worth putting this into its own PR.

- Move `descendant_filtered_examples.empty?` check
  out into the `run` method.
- This allows us to only create the instances for
  the context hooks if we need to actually run the
  hooks.
- Move `before_context_ivars.clear` into
  `run_after_context_hooks`. This gives it
  parity with `run_before_context_hooks`.
The runner has no business understanding the details
of running the config object’s :suite hooks.
This includes new spec coverage for `(prepend|append)_(before|after)(:suite)`.

Also, only reference these hooks on the config object.
I plan to remove them from the `Hooks` module since they
are not general purpose hooks.
...rather than delegating it to the Hooks module.

This will allow us to remove :suite support from the
hooks module, since it’s not something that is
generally supported in other hook contexts.
The Configuration class now handles these and it’s
the only place they are supported.

This allows us to reduce object allocations a bit,
and also clarifies the semantics of :suite hooks.
`append_after` is the registration method, not the
type — the type is `after`.
@myronmarston myronmarston force-pushed the hook-refactoring-plus-suite-hook-fixes branch from 5352b0b to 900ec2c Compare December 15, 2014 23:18
@myronmarston
Copy link
Member Author

Anyone want to review this? I just rebased and force pushed to deal with the merge conflict...

/cc @rspec/rspec

@xaviershay
Copy link
Member

LGTM

@myronmarston
Copy link
Member Author

Thanks for the quick review, @xaviershay. I'll merge when green.

myronmarston added a commit that referenced this pull request Dec 15, 2014
…fixes

Hook refactoring plus suite hook fixes
@myronmarston myronmarston merged commit 8c35cc5 into master Dec 15, 2014
@myronmarston myronmarston deleted the hook-refactoring-plus-suite-hook-fixes branch December 15, 2014 23:51
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
…hook-fixes

Hook refactoring plus suite hook fixes
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.

2 participants