Class: Section
- Inherits:
-
Object
- Object
- Section
- Defined in:
- lib/section.rb
Class Method Summary collapse
Instance Method Summary collapse
- #fails ⇒ Object
- #inc_fails(n = 1) ⇒ Object
- #inc_passes(n = 1) ⇒ Object
- #inc_tests(n = 1) ⇒ Object
-
#initialize(desc) ⇒ Section
constructor
A new instance of Section.
- #passes ⇒ Object
- #push_cleanup(block) ⇒ Object
- #push_setup(block) ⇒ Object
- #run_cleanups ⇒ Object
- #run_setups ⇒ Object
- #tests ⇒ Object
Constructor Details
#initialize(desc) ⇒ Section
Returns a new instance of Section.
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/section.rb', line 2 def initialize(desc) @desc = 0 @tests = 0 @passes = 0 @fails = 0 @setups = [] @cleanups = [] @@specstack ||= [] @@specstack.push self end |
Class Method Details
.lastspec ⇒ Object
57 58 59 |
# File 'lib/section.rb', line 57 def self.lastspec @@specstack.last end |
.specstack ⇒ Object
61 62 63 |
# File 'lib/section.rb', line 61 def self.specstack @@specstack end |
Instance Method Details
#fails ⇒ Object
21 22 23 |
# File 'lib/section.rb', line 21 def fails @fails end |
#inc_fails(n = 1) ⇒ Object
33 34 35 |
# File 'lib/section.rb', line 33 def inc_fails(n = 1) @fails += n end |
#inc_passes(n = 1) ⇒ Object
29 30 31 |
# File 'lib/section.rb', line 29 def inc_passes(n = 1) @passes += n end |
#inc_tests(n = 1) ⇒ Object
25 26 27 |
# File 'lib/section.rb', line 25 def inc_tests(n = 1) @tests += n end |
#passes ⇒ Object
17 18 19 |
# File 'lib/section.rb', line 17 def passes @passes end |
#push_cleanup(block) ⇒ Object
41 42 43 |
# File 'lib/section.rb', line 41 def push_cleanup(block) @cleanups << block end |
#push_setup(block) ⇒ Object
37 38 39 |
# File 'lib/section.rb', line 37 def push_setup(block) @setups << block end |
#run_cleanups ⇒ Object
51 52 53 54 55 |
# File 'lib/section.rb', line 51 def run_cleanups @cleanups.each do |cleanup| cleanup.call end end |
#run_setups ⇒ Object
45 46 47 48 49 |
# File 'lib/section.rb', line 45 def run_setups @setups.each do |setup| setup.call end end |
#tests ⇒ Object
13 14 15 |
# File 'lib/section.rb', line 13 def tests @tests end |