Class: Rubinium::TestSuite

Inherits:
Object
  • Object
show all
Defined in:
lib/rubinium/test_suite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "Unnamed test suite") {|_self| ... } ⇒ TestSuite

Returns a new instance of TestSuite.

Yields:

  • (_self)

Yield Parameters:



4
5
6
7
8
9
# File 'lib/rubinium/test_suite.rb', line 4

def initialize(name = "Unnamed test suite")
  @name = name
  @basedir = ARGV[0] || "."
  @tests = []
  yield self if block_given?
end

Instance Attribute Details

#basedirObject

Returns the value of attribute basedir.



2
3
4
# File 'lib/rubinium/test_suite.rb', line 2

def basedir
  @basedir
end

#filenameObject

Returns the value of attribute filename.



2
3
4
# File 'lib/rubinium/test_suite.rb', line 2

def filename
  @filename
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/rubinium/test_suite.rb', line 2

def name
  @name
end

#testsObject

Returns the value of attribute tests.



2
3
4
# File 'lib/rubinium/test_suite.rb', line 2

def tests
  @tests
end

Instance Method Details

#<<(test) ⇒ Object



11
12
13
# File 'lib/rubinium/test_suite.rb', line 11

def <<(test)
  @tests << test
end

#clearObject



27
28
29
# File 'lib/rubinium/test_suite.rb', line 27

def clear
  @tests.clear
end

#generateObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rubinium/test_suite.rb', line 15

def generate
  testfiles = []
  @tests.each do |test|
    filename = File.join(@basedir, test.filename)
    testfiles << [test.name, test.filename]
    File.open(filename, "w") do |file|
      test.generate(file)
    end
  end
  generate_suite testfiles
end