class Fluent::Test::TestDriver
Attributes
config[R]
instance[R]
Public Class Methods
new(klass, &block)
click to toggle source
# File lib/fluent/test/base.rb, line 37 def initialize(klass, &block) if klass.is_a?(Class) if block # Create new class for test w/ overwritten methods # klass.dup is worse because its ancestors does NOT include original class name klass = Class.new(klass) klass.module_eval(&block) end @instance = klass.new else @instance = klass end @instance.log = TestLogger.new @config = Config.new end
Public Instance Methods
configure(str, use_v1 = false)
click to toggle source
# File lib/fluent/test/base.rb, line 56 def configure(str, use_v1 = false) if str.is_a?(Fluent::Config::Element) @config = str else @config = Config.parse(str, "(test)", "(test_dir)", use_v1) end @instance.configure(@config) self end
run() { || ... }
click to toggle source
# File lib/fluent/test/base.rb, line 66 def run(&block) @instance.start begin # wait until thread starts 10.times { sleep 0.05 } return yield ensure @instance.shutdown end end