Test with a shell script instead of shell command

This commit is contained in:
Joe Ferris 2016-10-07 10:31:38 -04:00
parent 098fcc2816
commit 1ef679fafc
No known key found for this signature in database
GPG Key ID: 1B00F8C9678CF148
2 changed files with 5 additions and 6 deletions

3
spec/fixtures/fake_server.sh vendored Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
sleep 1

View File

@ -36,7 +36,7 @@ describe Capybara::Webkit::Connection do
end
it "raises an error if the server is not ready", skip_on_windows: true do
server_path = "sleep 1"
server_path = File.expand_path(File.join(__FILE__, "..", "fixtures", "fake_server.sh"))
stub_const("Capybara::Webkit::Server::SERVER_PATH", server_path)
start_timeout = 0.5
stub_const(
@ -45,11 +45,7 @@ describe Capybara::Webkit::Connection do
)
error_string =
if defined?(::JRUBY_VERSION)
"#{server_path} failed to start."
else
"#{server_path} failed to start after #{start_timeout} seconds."
end
"#{server_path} failed to start after #{start_timeout} seconds."
expect { start_server }.
to raise_error(Capybara::Webkit::ConnectionError, error_string)