Class: SimpleJUnit::TestSuiteCollection

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/simple_junit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTestSuiteCollection

Returns a new instance of TestSuiteCollection.



12
13
14
15
# File 'lib/simple_junit.rb', line 12

def initialize
  # initialization code needs to be put in reset method for testing
  self.reset
end

Instance Attribute Details

#testsuitesObject (readonly)

Returns the value of attribute testsuites.



10
11
12
# File 'lib/simple_junit.rb', line 10

def testsuites
  @testsuites
end

Instance Method Details

#create_testsuite(name) ⇒ Object



17
18
19
20
# File 'lib/simple_junit.rb', line 17

def create_testsuite(name)
  @testsuites << SimpleJUnit::TestSuite.new(name)
  @testsuites.last
end

#resetObject

This is really the initialize method, but for testing we want to be able to reset the singleton to an initialized state



33
34
35
# File 'lib/simple_junit.rb', line 33

def reset
  @testsuites = []
end

#to_sObject



22
23
24
25
26
27
28
29
# File 'lib/simple_junit.rb', line 22

def to_s
  return <<-EOTC
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
#{(@testsuites.each {|ts| ts.to_s}).join}
</testsuites>
EOTC
end