lib/autotest/cucumber_mixin.rb in cucumber-7.1.0 vs lib/autotest/cucumber_mixin.rb in cucumber-8.0.0.rc.1
- old
+ new
@@ -22,11 +22,11 @@
reset
reset_features
add_sigint_handler
loop do # ^c handler
- get_to_green
+ wait_for_green
if tainted
rerun_all_tests
rerun_all_features if all_good
else
hook :all_good
@@ -35,21 +35,22 @@
# Once tests and features are green, reset features every
# time a file is changed to see if anything breaks.
reset_features
rescue Interrupt
break if wants_to_quit
+
reset
reset_features
end
hook :quit
end
def all_features_good
features_to_run == ''
end
- def get_to_green # rubocop:disable Naming/AccessorMethodName
+ def wait_for_green
loop do
super
run_features
wait_for_changes unless all_features_good
break if all_features_good
@@ -68,10 +69,11 @@
def run_features
hook :run_features
Tempfile.open('autotest-cucumber') do |dirty_features_file|
cmd = make_cucumber_cmd(features_to_run, dirty_features_file.path)
break if cmd.empty?
+
old_sync = $stdout.sync
$stdout.sync = true
self.results = []
line = []
begin
@@ -79,9 +81,10 @@
until f.eof?
c = f.getc || break
print(c)
line << c
next unless c == "\n"
+
results << line.join
line.clear
end
end
ensure