Skip to content

Commit

Permalink
fixup! Enable test helper for all
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexB52 committed Dec 8, 2024
1 parent 75c41ab commit c672bdd
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 35 deletions.
11 changes: 4 additions & 7 deletions features/bundler-app/retest/support/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@

module RetestHelper
# COMMAND
def launch_retest(command, sleep_seconds: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5)))
def launch_retest(command, sleep_for: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5)))
require 'open3'
@input, @output, @stderr, @wait_thr = Open3.popen3(command)
@pid = @wait_thr[:pid]
sleep sleep_seconds
sleep sleep_for
end

def end_retest
@input&.close
@stderr&.close
@output&.close
if @pid
Process.kill('SIGHUP', @pid)
Process.detach(@pid)
end
@wait_thr.exit
end

# ASSERTIONS
Expand All @@ -42,7 +39,7 @@ def read_output(output = @output)
result = ""
loop do
result += output.read_nonblock(1024)
rescue IO::WaitReadable
rescue IO::WaitReadable, EOFError
break
end

Expand Down
9 changes: 3 additions & 6 deletions features/git-ruby/retest/support/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@

module RetestHelper
# COMMAND
def launch_retest(command, sleep_seconds: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5)))
def launch_retest(command, sleep_for: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5)))
require 'open3'
@input, @output, @stderr, @wait_thr = Open3.popen3(command)
@pid = @wait_thr[:pid]
sleep sleep_seconds
sleep sleep_for
end

def end_retest
@input&.close
@stderr&.close
@output&.close
if @pid
Process.kill('SIGHUP', @pid)
Process.detach(@pid)
end
@wait_thr.exit
end

# ASSERTIONS
Expand Down
9 changes: 3 additions & 6 deletions features/hanami-app/retest/support/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@

module RetestHelper
# COMMAND
def launch_retest(command, sleep_seconds: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5)))
def launch_retest(command, sleep_for: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5)))
require 'open3'
@input, @output, @stderr, @wait_thr = Open3.popen3(command)
@pid = @wait_thr[:pid]
sleep sleep_seconds
sleep sleep_for
end

def end_retest
@input&.close
@stderr&.close
@output&.close
if @pid
Process.kill('SIGHUP', @pid)
Process.detach(@pid)
end
@wait_thr.exit
end

# ASSERTIONS
Expand Down
5 changes: 1 addition & 4 deletions features/rails-app/retest/support/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ def end_retest
@input&.close
@stderr&.close
@output&.close
if @pid
Process.kill('SIGHUP', @pid)
Process.detach(@pid)
end
@wait_thr.exit
end

# ASSERTIONS
Expand Down
5 changes: 1 addition & 4 deletions features/rspec-rails/retest/support/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ def end_retest
@input&.close
@stderr&.close
@output&.close
if @pid
Process.kill('SIGHUP', @pid)
Process.detach(@pid)
end
@wait_thr.exit
end

# ASSERTIONS
Expand Down
5 changes: 1 addition & 4 deletions features/rspec-ruby/retest/support/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ def end_retest
@input&.close
@stderr&.close
@output&.close
if @pid
Process.kill('SIGHUP', @pid)
Process.detach(@pid)
end
@wait_thr.exit
end

# ASSERTIONS
Expand Down
5 changes: 1 addition & 4 deletions features/ruby-app/retest/support/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ def end_retest
@input&.close
@stderr&.close
@output&.close
if @pid
Process.kill('SIGHUP', @pid)
Process.detach(@pid)
end
@wait_thr.exit
end

# ASSERTIONS
Expand Down

0 comments on commit c672bdd

Please sign in to comment.