-
-
Notifications
You must be signed in to change notification settings - Fork 757
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
skip
within before(:all)
of isolated example group causes outer example group to be pending
#2603
Comments
👋 If you have a look at the rspec-core specs you will see all sorts of protection and isolation (sand boxing) to allow us to run specs within rspec, its not a "public api" intended to be used in the way you are using it. You will probably need to replicate what we've done to ensure the "inner rspec" works from the outer rspec, in both your examples you should see only 1 spec output for example... May I ask why you are trying to test before hooks? Is this report psuedo coded from something else? |
@JonRowe We're trying to add some new features on top of RSpec, and would like to write tests for them. You can find more context at: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24942#note_140637060 |
Yeah, this is a minimal reproduction of something more complex, as @godfat noted. Essentially, we're trying to allow tests to be skipped unless focused (e.g., as if running rspec with That worked, but when I tried to write unit tests of the configuration I ran into this issue. |
Ok so as a minimum you need to setup a reporter of your own, and pass it to Then you're going to want |
You can see examples of this in our spec/spec_helper.rb and spec/support/sandboxing.rb. |
Ahh, thanks @JonRowe! That explains a few things about the RSpec unit tests that I wasn't understanding, like how tests of configuration didn't affect other tests. With that I managed to get a simple test passing. It should be enough to fix the rest of out tests, so I'll close this. |
Subject of the issue
I'm trying to write tests for before hooks and have run into trouble. When a
before(:all)
hook is skipped in an isolated example group it sets the outer example group as pending, but it should pass.Your environment
Steps to reproduce
Expected behavior
Actual behavior
More info
Strangely, it's fine if the test has multiple isolated example groups:
The text was updated successfully, but these errors were encountered: