From 1ef679fafc08654a1e1b6b50070425af89d5e427 Mon Sep 17 00:00:00 2001 From: Joe Ferris Date: Fri, 7 Oct 2016 10:31:38 -0400 Subject: [PATCH] Test with a shell script instead of shell command --- spec/fixtures/fake_server.sh | 3 +++ spec/server_spec.rb | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100755 spec/fixtures/fake_server.sh diff --git a/spec/fixtures/fake_server.sh b/spec/fixtures/fake_server.sh new file mode 100755 index 0000000..0720d46 --- /dev/null +++ b/spec/fixtures/fake_server.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +sleep 1 diff --git a/spec/server_spec.rb b/spec/server_spec.rb index 7176a74..619a910 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -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)