lib/gurke/runner.rb in gurke-2.0.0.dev.1.b18 vs lib/gurke/runner.rb in gurke-2.0.0.dev.1.b19
- old
+ new
@@ -2,12 +2,14 @@
#
class Runner
attr_reader :builder
attr_reader :files
attr_reader :options
+ attr_reader :config
- def initialize(files, options = {})
+ def initialize(config, files, options = {})
+ @config = config
@options = options
@files = files
@builder = Builder.new options
end
@@ -22,21 +24,10 @@
features.run self, reporter
end
def hook(scope, world, &block)
- Configuration::BEFORE_HOOKS.for(scope).each{|hook| hook.run world }
- Configuration::AROUND_HOOKS.for(scope).reduce(block) do |blk, hook|
- proc { hook.run(world, blk) }
- end.call
- ensure
- Configuration::AFTER_HOOKS.for(scope).each do |hook|
- begin
- hook.run world
- rescue => e
- warn "Rescued error in after hook: #{e}\n#{e.backtrace.join("\n")}"
- end
- end
+ config.hooks[scope].run world, &block
end
def with_filtered_backtrace
yield
rescue => e