Class: Test::Unit::TestSuiteCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/test/unit/testsuitecreator.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(test_case) ⇒ TestSuiteCreator

Returns a new instance of TestSuiteCreator.



11
12
13
# File 'lib/test/unit/testsuitecreator.rb', line 11

def initialize(test_case)
  @test_case = test_case
end

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/test/unit/testsuitecreator.rb', line 15

def create
  suite = TestSuite.new(@test_case.name, @test_case)
  collect_test_names.each do |test_name|
    data_sets = @test_case.attributes(test_name)[:data]
    if data_sets
      data_sets.each do |data_set|
        data_set = data_set.call if data_set.respond_to?(:call)
        data_set.each do |label, data|
          append_test(suite, test_name) do |test|
            test.assign_test_data(label, data)
          end
        end
      end
    else
      append_test(suite, test_name)
    end
  end
  append_test(suite, "default_test") if suite.empty?
  suite
end