/
rack.rb
36 lines (30 loc) · 927 Bytes
/
rack.rb
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
28
29
30
31
32
33
34
35
36
require "webrat/selenium/application_servers/base"
module Webrat
module Selenium
module ApplicationServers
class Rack < Webrat::Selenium::ApplicationServers::Base
def start
@pid = fork do
exec start_command
end
end
def stop
Process.kill("TERM", @pid)
end
def fail
$stderr.puts
$stderr.puts
$stderr.puts "==> Failed to boot the application server... exiting!"
$stderr.puts
$stderr.puts "Verify you can start a server on port #{Webrat.configuration.application_port} with the following command:"
$stderr.puts
$stderr.puts " #{start_command}"
exit
end
def start_command
"rackup --port #{Webrat.configuration.application_port} --env #{Webrat.configuration.application_environment}"
end
end
end
end
end