module Test::Unit::Fixture::ClassMethods - test-unit: Ruby Standard Library Documentation

# module Test::Unit::Fixture::ClassMethods

### Public Instance Methods

cleanup(*method_names, &callback) click to toggle source

    # File test-unit-3.6.7/lib/test/unit/fixture.rb, line 218
    def cleanup(*method_names, &callback)
      register_fixture(:cleanup, *method_names, &callback)
    end

fixture() click to toggle source

    # File test-unit-3.6.7/lib/test/unit/fixture.rb, line 206
    def fixture
      @fixture ||= Fixture.new(self)
    end

setup(*method_names, &callback) click to toggle source

    # File test-unit-3.6.7/lib/test/unit/fixture.rb, line 210
    def setup(*method_names, &callback)
      register_fixture(:setup, *method_names, &callback)
    end

teardown(*method_names, &callback) click to toggle source

    # File test-unit-3.6.7/lib/test/unit/fixture.rb, line 226
    def teardown(*method_names, &callback)
      register_fixture(:teardown, *method_names, &callback)
    end

unregister_cleanup(*method_names_or_callbacks) click to toggle source

    # File test-unit-3.6.7/lib/test/unit/fixture.rb, line 222
    def unregister_cleanup(*method_names_or_callbacks)
      unregister_fixture(:cleanup, *method_names_or_callbacks)
    end

unregister_setup(*method_names_or_callbacks) click to toggle source

    # File test-unit-3.6.7/lib/test/unit/fixture.rb, line 214
    def unregister_setup(*method_names_or_callbacks)
      unregister_fixture(:setup, *method_names_or_callbacks)
    end

unregister_teardown(*method_names_or_callbacks) click to toggle source

    # File test-unit-3.6.7/lib/test/unit/fixture.rb, line 230
    def unregister_teardown(*method_names_or_callbacks)
      unregister_fixture(:teardown, *method_names_or_callbacks)
    end

### Private Instance Methods

register_fixture(fixture, *method_names, &callback) click to toggle source

    # File test-unit-3.6.7/lib/test/unit/fixture.rb, line 235
    def register_fixture(fixture, *method_names, &callback)
      options = {}
      options = method_names.pop if method_names.last.is_a?(Hash)
      callbacks = method_names
      callbacks << callback if callback
      attribute(fixture, options, *callbacks)
    end

unregister_fixture(fixture, *method_names_or_callbacks) click to toggle source

    # File test-unit-3.6.7/lib/test/unit/fixture.rb, line 243
    def unregister_fixture(fixture, *method_names_or_callbacks)
      attribute(fixture, nil, *method_names_or_callbacks)
    end