From 1f0de36e411350ddf58c4195011a97ada1547630 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 15 Aug 2013 11:11:14 +1000 Subject: [PATCH] extract method --- lib/autospec/runner.rb | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/autospec/runner.rb b/lib/autospec/runner.rb index b5d5027e3ca..761f21f7292 100644 --- a/lib/autospec/runner.rb +++ b/lib/autospec/runner.rb @@ -236,16 +236,7 @@ class Autospec::Runner last_failed = false current = @queue.last if current - result = run_spec(current[1]) - if result == 0 - @queue.pop - else - last_failed = true - if result.to_i > 0 - focus_on_failed_tests - ensure_all_specs_will_run - end - end + last_failed = process_spec(current[1]) end wait = @queue.length == 0 || last_failed @signal.wait(@mutex) if wait @@ -256,6 +247,21 @@ class Autospec::Runner puts e.backtrace end + def process_spec(spec) + last_failed = false + if run_spec(spec) == 0 + @queue.pop + else + last_failed = true + if result.to_i > 0 + focus_on_failed_tests + ensure_all_specs_will_run + end + end + + last_failed + end + def start_service_queue @worker ||= Thread.new do while true