This repository has been archived by the owner on Nov 19, 2021. It is now read-only.
forked from brynary/webrat
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add code to start an app server for any Rack app via rackup
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |