summaryrefslogtreecommitdiff
path: root/spec/support/server.rb
blob: 51d4ed8f0d5acf2de458d2a65094f0017e0c8b7a (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
25
26
27
# frozen_string_literal: true

RSpec.configure do |config|
  config.add_setting :http
  config.http = Net::Hippie::Client.new

  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