Class: Turn::TestSuite

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/turn/components/suite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#casesObject

Returns the value of attribute cases.



10
11
12
# File 'lib/turn/components/suite.rb', line 10

def cases
  @cases
end

#count_assertionsObject

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

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/turn/components/suite.rb', line 8

def name
  @name
end

#sizeObject

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_errorsObject



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_failuresObject



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_passesObject



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_testsObject



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

#countsObject

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

Returns:

  • (Boolean)


79
80
81
# File 'lib/turn/components/suite.rb', line 79

def passed?
  (count_failures == 0 && count_errors == 0)
end