lib/gurke/runner.rb in gurke-2.4.2 vs lib/gurke/runner.rb in gurke-3.0.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Gurke class Runner attr_reader :config, :options def initialize(config, options = {}) @@ -7,11 +9,15 @@ @options = options end def reporter @reporter ||= begin - r = (options[:formatter] + '_reporter').split('_').map(&:capitalize).join + r = (options[:formatter] + '_reporter') + .split('_') + .map(&:capitalize) + .join + Reporters.const_get(r).new end end def builder @@ -19,27 +25,27 @@ end def run(files, reporter = self.reporter) files.map! do |file| split = file.split(':') - [split[0], split[1..-1].map{|i| Integer(i) }] + [split[0], split[1..-1].map {|i| Integer(i) }] end - features = builder.load files.map{|file, _| file } + features = builder.load(files.map {|file, _| file }) features.filter(options, files).run self, reporter end def hook(scope, world, context, &block) config.hooks[scope].run world, context, &block end def with_filtered_backtrace yield - rescue => e + 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 } + e.backtrace.select! {|l| File.expand_path(l)[0...base.size] == base } end raise end class LocalRunner < Runner @@ -51,10 +57,10 @@ end class DRbServer < Runner URI = 'druby://localhost:8789' - def run(files) + def run(_files) require 'drb' hook :system, nil, nil do DRb.start_service URI, self $stdout.puts 'DRb Server running...'