class Gurke::Runner

Attributes

config[R]
options[R]

Public Class Methods

new(config, options = {}) click to toggle source
# File lib/gurke/runner.rb, line 7
def initialize(config, options = {})
  @config  = config
  @options = options
end

Public Instance Methods

builder() click to toggle source
# File lib/gurke/runner.rb, line 23
def builder
  @builder ||= Builder.new
end
hook(scope, world, context, &block) click to toggle source
# File lib/gurke/runner.rb, line 41
def hook(scope, world, context, &block)
  config.hooks[scope].run world, context, &block
end
reporter() click to toggle source
# File lib/gurke/runner.rb, line 12
def reporter
  @reporter ||= begin
    r = (options[:formatter] + '_reporter')
        .split('_')
        .map(&:capitalize)
        .join

    Reporters.const_get(r).new
  end
end
retries(scenario) click to toggle source
# File lib/gurke/runner.rb, line 37
def retries(scenario)
  scenario.flaky? ? config.flaky_retries : config.default_retries
end
run(files, reporter = self.reporter) click to toggle source
# File lib/gurke/runner.rb, line 27
def run(files, reporter = self.reporter)
  files.map! do |file|
    split = file.split(':')
    [split[0], split[1..-1].map {|i| Integer(i) }]
  end

  features = builder.load(files.map {|file, _| file })
  features.filter(options, files).run self, reporter
end
with_filtered_backtrace() { || ... } click to toggle source
# File lib/gurke/runner.rb, line 45
def with_filtered_backtrace
  yield
rescue StandardError => e
  unless options[:backtrace]
    base = File.expand_path(Gurke.root.dirname)
    e.backtrace.select! {|l| File.expand_path(l)[0...base.size] == base }
  end
  raise
end