Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from shellspec/fix_before_after_all
Fixes BeforeAll / AfterAll to share states
- Loading branch information
Showing
8 changed files
with
209 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#shellcheck shell=sh disable=SC2016 | ||
|
||
BeforeAll 'var=0' | ||
Describe 'BeforeAll / AfterAll hook' | ||
BeforeAll '[ "$var" = 0 ] && var=$(($var+1))' | ||
AfterAll 'var=$(($var-1)) && [ "$var" = 0 ]' | ||
|
||
Specify "BeforeAll calls once per block" | ||
The variable var should eq 1 | ||
End | ||
|
||
Specify "BeforeAll shares the state" | ||
The variable var should eq 1 | ||
End | ||
End | ||
|
||
Example | ||
The variable var should eq 0 | ||
End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.