Skip to content

Commit

Permalink
Add some thread safety defense
Browse files Browse the repository at this point in the history
To make sure only one definition block can run at a time so that global
`describe` and `it` functions don’t get mis-attached.
  • Loading branch information
greghaskins committed Feb 1, 2016
1 parent b0a3b44 commit 0e88033
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/greghaskins/spectrum/Spectrum.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void run(final RunNotifier notifier) {
this.rootSuite.run(notifier);
}

private static void beginDefintion(final Suite suite, final Block definitionBlock) {
synchronized private static void beginDefintion(final Suite suite, final Block definitionBlock) {
suiteStack.push(suite);
try {
definitionBlock.run();
Expand All @@ -156,7 +156,7 @@ private static void beginDefintion(final Suite suite, final Block definitionBloc
suiteStack.pop();
}

private static Suite getCurrentSuite() {
synchronized private static Suite getCurrentSuite() {
return suiteStack.peek();
}

Expand Down

0 comments on commit 0e88033

Please sign in to comment.