Created
July 9, 2010 21:45
-
-
Save toothrot/470111 to your computer and use it in GitHub Desktop.
how setups get run in Riot
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
context setups | |
+ asserts should only run the setup once | |
+ asserts even with multiple assertions | |
context setups that are nested | |
+ asserts gets run again | |
+ asserts only once per nesting, even with multiple assertions | |
4 passes, 0 failures, 0 errors in 0.000148 seconds |
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
require 'rubygems' | |
require 'riot' | |
context "context setups" do | |
setup do | |
$i ||= 0 | |
$i += 1 | |
end | |
asserts('should only run the setup once') { $i == 1 } | |
asserts('even with multiple assertions') { $i == 1} | |
context "that are nested" do | |
asserts('gets run again') { $i == 2 } | |
asserts('only once per nesting, even with multiple assertions') { $i == 2} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment