summaryrefslogtreecommitdiff
path: root/spec/support/server.rb
blob: 2fea6afa929b3b5a377838a28b6c36ce0a8bc9a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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