Module: Dataset::Extensions::TestUnitTestCase

Defined in:
lib/dataset/extensions/test_unit.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(test_case) ⇒ Object



28
29
30
31
32
# File 'lib/dataset/extensions/test_unit.rb', line 28

def self.extended(test_case)
  class << test_case
    alias_method_chain :suite, :dataset
  end
end

Instance Method Details

#dataset(*datasets, &block) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/dataset/extensions/test_unit.rb', line 38

def dataset(*datasets, &block)
  add_dataset(*datasets, &block)
  
  # Unfortunately, if we have rspec loaded, TestCase has it's suite method
  # modified for the test/unit runners, but uses a different mechanism to
  # collect tests if the rspec runners are used.
  if included_modules.find {|m| m.name =~ /ExampleMethods\Z/}
    load = nil
    before(:all) do
      load = dataset_session.load_datasets_for(self.class)
      extend_from_dataset_load(load)
    end
    before(:each) do
      extend_from_dataset_load(load)
    end
  end
end

#suite_with_datasetObject



34
35
36
# File 'lib/dataset/extensions/test_unit.rb', line 34

def suite_with_dataset
  Dataset::TestSuite.new(suite_without_dataset, self)
end