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
-
#name ⇒ Object
Returns the value of attribute name.
-
#seed ⇒ Object
Returns the value of attribute seed.
Instance Method Summary collapse
- #count_errors ⇒ Object
- #count_failures ⇒ Object
- #count_passes ⇒ Object
- #count_skips ⇒ 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
- #size ⇒ Object
-
#size=(number) ⇒ Object
Why the size would ever have to overridden…
Constructor Details
#initialize(name = nil) ⇒ TestSuite
Returns a new instance of TestSuite.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/turn/components/suite.rb', line 17 def initialize(name=nil) @name = name @cases = [] @size = nil @seed = nil #@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.
9 10 11 |
# File 'lib/turn/components/suite.rb', line 9 def cases @cases end |
#count_assertions ⇒ Object
43 44 45 46 47 |
# File 'lib/turn/components/suite.rb', line 43 def count_assertions #@count_assertions ||= ( sum = 0; each{ |c| sum += c.count_assertions }; sum #) end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/turn/components/suite.rb', line 8 def name @name end |
#seed ⇒ Object
Returns the value of attribute seed.
10 11 12 |
# File 'lib/turn/components/suite.rb', line 10 def seed @seed end |
Instance Method Details
#count_errors ⇒ Object
55 56 57 58 59 |
# File 'lib/turn/components/suite.rb', line 55 def count_errors #@count_errors ||= ( sum = 0; each{ |c| sum += c.count_errors }; sum #) end |
#count_failures ⇒ Object
49 50 51 52 53 |
# File 'lib/turn/components/suite.rb', line 49 def count_failures #@count_failures ||= ( sum = 0; each{ |c| sum += c.count_failures }; sum #) end |
#count_passes ⇒ Object
61 62 63 64 65 |
# File 'lib/turn/components/suite.rb', line 61 def count_passes #@count_passes ||= ( sum = 0; each{ |c| sum += c.count_passes }; sum #) end |
#count_skips ⇒ Object
67 68 69 |
# File 'lib/turn/components/suite.rb', line 67 def count_skips sum = 0; each{ |c| sum += c.count_skips }; sum end |
#count_tests ⇒ Object
37 38 39 40 41 |
# File 'lib/turn/components/suite.rb', line 37 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.
72 73 74 |
# File 'lib/turn/components/suite.rb', line 72 def counts return count_tests, count_assertions, count_failures, count_errors ,count_skips end |
#each(&block) ⇒ Object
76 77 78 |
# File 'lib/turn/components/suite.rb', line 76 def each(&block) @cases.each(&block) end |
#new_case(name, *files) ⇒ Object
31 32 33 34 35 |
# File 'lib/turn/components/suite.rb', line 31 def new_case(name, *files) c = TestCase.new(name, *files) @cases << c c end |
#passed? ⇒ Boolean
89 90 91 |
# File 'lib/turn/components/suite.rb', line 89 def passed? (count_failures == 0 && count_errors == 0) end |
#size ⇒ Object
80 81 82 |
# File 'lib/turn/components/suite.rb', line 80 def size @size ||= @cases.size end |
#size=(number) ⇒ Object
Why the size would ever have to overridden… well who can say.
85 86 87 |
# File 'lib/turn/components/suite.rb', line 85 def size=(number) @size = number.to_i end |