Class: Test::Unit::TestSuiteCreator
- Inherits:
-
Object
- Object
- Test::Unit::TestSuiteCreator
- Defined in:
- lib/test/unit/test-suite-creator.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(test_case) ⇒ TestSuiteCreator
constructor
A new instance of TestSuiteCreator.
Constructor Details
#initialize(test_case) ⇒ TestSuiteCreator
Returns a new instance of TestSuiteCreator.
18 19 20 |
# File 'lib/test/unit/test-suite-creator.rb', line 18 def initialize(test_case) @test_case = test_case end |
Class Method Details
.test_method?(test_case, method_name) ⇒ Boolean
12 13 14 15 |
# File 'lib/test/unit/test-suite-creator.rb', line 12 def test_method?(test_case, method_name) /\Atest./ =~ method_name.to_s or test_case.find_attribute(method_name, :test) end |
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/test/unit/test-suite-creator.rb', line 22 def create suite = TestSuite.new(@test_case.name, @test_case) collect_test_names.each do |test_name| data_sets = @test_case.find_attribute(test_name, :data, :recursive => false) 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 |