module Test::Unit::Fixture

Public Class Methods

included(base) click to toggle source
# File test-unit-3.3.7/lib/test/unit/fixture.rb, line 5
def included(base)
  base.extend(ClassMethods)

  [:setup, :cleanup, :teardown].each do |type|
    observer = lambda do |test_case, _, _, value, callback|
      if value.nil?
        test_case.fixture[type].unregister(callback)
      else
        test_case.fixture[type].register(callback, value)
      end
    end
    base.register_attribute_observer(type, &observer)
  end
end