lib/lopata/runner.rb in lopata-0.1.6 vs lib/lopata/runner.rb in lopata-0.1.7

- old
+ new

@@ -5,24 +5,26 @@ require_relative '../lopata' require_relative 'observers' require_relative 'condition' module Lopata + # @private class Runner < Thor desc 'test', 'Run tests' option :env, default: :qa, aliases: 'e' option :rerun, type: :boolean, aliases: 'r' option :keep, type: :boolean, aliases: 'k' option :text, aliases: 't' def test(*args) + trap_interrupt configure_from_options Lopata::Loader.load_shared_steps Lopata::Loader.load_scenarios(*args) world = Lopata.world - world.start + world.notify_observers(:started, world) world.scenarios.each { |s| s.run } - world.finish + world.notify_observers(:finished, world) end default_task :test register Generators::App, :new, 'lopata new project-name', 'Init new lopata projects' @@ -48,9 +50,13 @@ end def add_rerun_filter to_rerun = Lopata::Client.new.to_rerun Lopata.configuration.filters << -> (scenario) { to_rerun.include?(scenario.title) } + end + + def trap_interrupt + trap('INT') { exit!(1) } end end end end