diff options
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/server.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/support/server.rb b/spec/support/server.rb new file mode 100644 index 0000000..2fea6af --- /dev/null +++ b/spec/support/server.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +RSpec.configure do |config| + config.add_setting :bind_addr + config.bind_addr = ENV.fetch("BIND_ADDR", "127.0.0.1:7878") + + config.add_setting :pid + + config.before :suite do + RSpec.configuration.pid = Process.spawn({ + "BIND_ADDR" => RSpec.configuration.bind_addr, + }, "mise exec -- cargo run") + sleep 1 + end + + config.after :suite do + Process.kill('SIGTERM', RSpec.configuration.pid) + system("killall sts") + end +end + +at_exit do + system("killall sts") +end |
