Skip to content
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

Refactor spec hooks #9090

Merged
merged 3 commits into from May 13, 2020
Merged

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Apr 15, 2020

  • Refactor all spec hooks to work in the root context
  • Deprecate hook methods in Spec namespace
  • Refactor and simplify implementation of spec hooks
  • Improve documentation of spec hooks
  • Add spec for spec hooks

Note: around_all does not work on the root context. Because the block is supposed to be called with a ExampleGroup. We could perhaps make it work with some effort, but I don't think that's necessary. It would not be have many use cases anyways. This wasn't possible before, so it won't be in this PR.

* Refactor all spec hooks to work in the root context
* Deprecate hook methods in Spec namespace
* Improve documentation of spec hooks
* Add spec for spec hooks
src/spec/dsl.cr Outdated Show resolved Hide resolved
spec/std/spec/hooks_spec.cr Outdated Show resolved Hide resolved
src/spec/dsl.cr Outdated Show resolved Hide resolved
@straight-shoota
Copy link
Member Author

I've removed the deprecation of Spec. methods. Instead top-level methods continue to raise on the top level context.

We can iterate on this behaviour later. It leaves the option to implement top-level methods as file-scoped hooks.

@straight-shoota
Copy link
Member Author

I don't think this is a breaking change anymore.

Also it doesn't resolve #8930 because it essentially only addresses the last point.

@straight-shoota straight-shoota added this to the 0.35.0 milestone May 11, 2020
@bcardiff bcardiff merged commit 433ca8e into crystal-lang:master May 13, 2020
@straight-shoota straight-shoota deleted the refactor/spec-hooks branch May 13, 2020 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants