Class: Turn::TestSuite
- Inherits:
-
Object
- Object
- Turn::TestSuite
- Includes:
- Enumerable
- Defined in:
- lib/turn/components/suite.rb
Instance Attribute Summary collapse
-
#cases ⇒ Object
Returns the value of attribute cases.
-
#count_assertions ⇒ Object
This one can be set manually since it is not calculatable (beyond the case level).
-
#name ⇒ Object
Returns the value of attribute name.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
- #count_errors ⇒ Object
- #count_failures ⇒ Object
- #count_passes ⇒ Object
- #count_tests ⇒ Object
-
#counts ⇒ Object
Convenience methods –this is what is typcially wanted.
- #each(&block) ⇒ Object
-
#initialize(name = nil) ⇒ TestSuite
constructor
A new instance of TestSuite.
- #new_case(name, *files) ⇒ Object
- #passed? ⇒ Boolean
Constructor Details
#initialize(name = nil) ⇒ TestSuite
Returns a new instance of TestSuite.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/turn/components/suite.rb', line 17 def initialize(name=nil) @name = name @size = nil @cases = [] #@count_tests = nil #@count_assertions = nil #@count_failures = nil #@count_errors = nil #@count_passes = nil end |
Instance Attribute Details
#cases ⇒ Object
Returns the value of attribute cases.
10 11 12 |
# File 'lib/turn/components/suite.rb', line 10 def cases @cases end |
#count_assertions ⇒ Object
This one can be set manually since it is not calculatable (beyond the case level).
14 15 16 |
# File 'lib/turn/components/suite.rb', line 14 def count_assertions @count_assertions end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/turn/components/suite.rb', line 8 def name @name end |
#size ⇒ Object
Returns the value of attribute size.
9 10 11 |
# File 'lib/turn/components/suite.rb', line 9 def size @size end |
Instance Method Details
#count_errors ⇒ Object
54 55 56 57 58 |
# File 'lib/turn/components/suite.rb', line 54 def count_errors #@count_errors ||= ( sum = 0; each{ |c| sum += c.count_errors }; sum #) end |
#count_failures ⇒ Object
48 49 50 51 52 |
# File 'lib/turn/components/suite.rb', line 48 def count_failures #@count_failures ||= ( sum = 0; each{ |c| sum += c.count_failures }; sum #) end |
#count_passes ⇒ Object
60 61 62 63 64 |
# File 'lib/turn/components/suite.rb', line 60 def count_passes #@count_passes ||= ( sum = 0; each{ |c| sum += c.count_passes }; sum #) end |
#count_tests ⇒ Object
36 37 38 39 40 |
# File 'lib/turn/components/suite.rb', line 36 def count_tests #@count_tests ||= ( sum = 0; each{ |c| sum += c.count_tests }; sum #) end |
#counts ⇒ Object
Convenience methods –this is what is typcially wanted.
67 68 69 |
# File 'lib/turn/components/suite.rb', line 67 def counts return count_tests, count_assertions, count_failures, count_errors #,count_skips end |
#each(&block) ⇒ Object
71 72 73 |
# File 'lib/turn/components/suite.rb', line 71 def each(&block) @cases.each(&block) end |
#new_case(name, *files) ⇒ Object
30 31 32 33 34 |
# File 'lib/turn/components/suite.rb', line 30 def new_case(name, *files) c = TestCase.new(name, *files) @cases << c c end |
#passed? ⇒ Boolean
79 80 81 |
# File 'lib/turn/components/suite.rb', line 79 def passed? (count_failures == 0 && count_errors == 0) end |