# File test-unit-3.3.4/lib/test/unit/fixture.rb, line 102 def initialize(test_case, type, default_options) @test_case = test_case @type = type @default_options = default_options @before_prepend_callbacks = [] @before_append_callbacks = [] @after_prepend_callbacks = [] @after_append_callbacks = [] @unregistered_callbacks = [] end
# File test-unit-3.3.4/lib/test/unit/fixture.rb, line 162 def after_append_callbacks @after_append_callbacks - @unregistered_callbacks end
# File test-unit-3.3.4/lib/test/unit/fixture.rb, line 158 def after_prepend_callbacks @after_prepend_callbacks - @unregistered_callbacks end
# File test-unit-3.3.4/lib/test/unit/fixture.rb, line 154 def before_append_callbacks @before_append_callbacks - @unregistered_callbacks end
# File test-unit-3.3.4/lib/test/unit/fixture.rb, line 150 def before_prepend_callbacks @before_prepend_callbacks - @unregistered_callbacks end
# File test-unit-3.3.4/lib/test/unit/fixture.rb, line 113 def register(method_name_or_callback, options=nil) options ||= {} unless valid_register_options?(options) message = "must be {:before => :prepend}, " + "{:before => :append}, {:after => :prepend} or " + "{:after => :append}: #{options.inspect}" raise ArgumentError, message end if options.empty? options = @default_options end before_how = options[:before] after_how = options[:after] if method_name_or_callback.respond_to?(:call) callback = method_name_or_callback method_name = callback_method_name(callback) @test_case.attribute(:source_location, callback.source_location, method_name) @test_case.__send__(:define_method, method_name, &callback) else method_name = method_name_or_callback end add_callback(method_name, before_how, after_how) end
# File test-unit-3.3.4/lib/test/unit/fixture.rb, line 140 def unregister(method_name_or_callback) if method_name_or_callback.respond_to?(:call) callback = method_name_or_callback method_name = callback_method_name(callback) else method_name = method_name_or_callback end @unregistered_callbacks << method_name end