-
Notifications
You must be signed in to change notification settings - Fork 64
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
Global before.each #79
Comments
Hey @raindrift! Mamba provides a before.all hook on every suite. Do you refer to all suites or with this hook is enough? Thanks! |
I know about the hooks. What I'm wondering is, can I have a before.all or a before.each on the entire test suite? For example, let's say I have a
Then, I'd love to remove that chunk of boilerplate from all my tests, though. It'd be great if there was some global configuration where I could specify these things. It'd make the test files cleaner, and reduce the chance that I'll forget to call it. |
+1 |
Oookey, I see :) It's something like before/after hooks in configuration, like RSpec ones: https://relishapp.com/rspec/rspec-core/v/3-7/docs/hooks/before-and-after-hooks#define-%60before%60-and-%60after%60-blocks-in-configuration And when we have tagging support, i thing this idea would be useful too: https://relishapp.com/rspec/rspec-core/v/3-7/docs/hooks/when-first-matching-example-defined-hook Thanks for the idea, I would consider it for 1.0 release :) |
Thanks for considering this @nestorsalceda |
@nestorsalceda will this feature be added anytime soon? Considering migrating from pytest > mamba, but having a global fixture (defining it only once) that runs for every single "it" block in my entire testing directory is essential. |
Yes, I think is easy to implement. I have some doubts about how to share state between the specs, but I think it can be done easily. I'm going to target it to next week release :) |
It'd be wonderful to be able to define a
before.each
for the entire suite. This would allow things like ensuring that the database is always cleared between examples. As it is, I have to do the global test setup once per file.With RSpec, which seems to be what mamba is modeled on, you can put
before(:each)
andbefore(:all)
in the global rspec configuration.The text was updated successfully, but these errors were encountered: