Class: RubyUnit::TestSet

Inherits:
Object
  • Object
show all
Defined in:
lib/RubyUnit/TestSet.rb

Overview

Test Sets are a collection of Test Cases

Direct Known Subclasses

TestSuite

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_cases) ⇒ TestSet

Create a test set and import test cases.



7
8
9
10
# File 'lib/RubyUnit/TestSet.rb', line 7

def initialize test_cases
  $:.unshift '.' unless $:.include? '.'
  import test_cases
end

Class Method Details

.typeObject

Defining type of files includes for RubyUnit::TestSuite used with –debug



24
25
26
# File 'lib/RubyUnit/TestSet.rb', line 24

def self.type
  'Test Case'
end

Instance Method Details

#import(test_cases) ⇒ Object

Import the test cases for this test set

Raises:

  • (TypeError)


14
15
16
17
18
19
20
# File 'lib/RubyUnit/TestSet.rb', line 14

def import test_cases
  raise TypeError, "File list must be an Array, got #{test_cases.class}" unless test_cases.is_a? Array
  test_cases.each do |test_case|
    puts "%20s : %s" % ['Adding ' + self.class.type, test_case] if RubyUnit.debug
    require test_case
  end
end