-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Make sibling Suites have separate contexts #1164
Make sibling Suites have separate contexts #1164
Conversation
@travisjeffery or @visionmedia any thoughts on this? |
@travisjeffery or @visionmedia still looking for input. |
seems like a good idea, I'll take a closer look later today On Tuesday, April 15, 2014, Jonathan Park notifications@github.com wrote:
|
+1 |
@travisjeffery, Thanks for looking at this, if you have any changes you would like, I can surely get some time today to resolve them. |
@travisjeffery I just realized that I should just leave all the original tests in place rather than trying to intermix the sibling tests. Should I break the sibling tests into a separate file as well? |
@park9140 no keep them in one context file |
@travisjeffery, cool, I'll leave it as is then. |
@park9140 ok and can you squash these commits into a single commit and force push your branch |
@travisjeffery, done |
…ontext Make sibling Suites have separate contexts
awesome thanks |
Why not use |
Since there is no cross talk between describe 'Something', ->
user = null
before -> user = Factory.build 'User'
it '', -> expect( user.name ).to.be.not.empty vs describe 'Something', ->
before -> @user = Factory.build 'User'
it '', -> expect( @user.name ).to.be.not.empty |
To me this seem to allow to use mocha finally, properly as an integration test framework too, not just as a unit test one, is that correct? With 'Feature: Scratch my head':
before -> @head = new Head
'Scenario: From the left':
'Given my head itches': -> @head.itch = true
'When I scratch it': -> ...
'Scenario: From the right': |
@onetom #1164 (comment) - either's fine. #1164 (comment) - probably could of used mocha before, but sure. |
The main context in mocha is currently shared by all suites.
This change makes it so that each suite can add values to it's own context without polluting the shared global context.
This allows a layer of automatic cleanup to occur between test suites. Making
after
mostly unnecessary if you are using the shared context to store setup rather than using the closure.