Change this test yet again to not rely on ps, and make it allow up to a second for the executable to be called.
This commit is contained in:
parent
70e7a4b6b9
commit
892d48b6f9
|
@ -1 +1,2 @@
|
|||
/Gemfile.lock
|
||||
/spec/support/custom_phantomjs_called
|
||||
|
|
|
@ -12,11 +12,23 @@ describe Capybara::Poltergeist::Driver do
|
|||
it_should_behave_like "driver with cookies support"
|
||||
|
||||
it 'should support a custom phantomjs path' do
|
||||
path = File.expand_path('../../support/custom_phantomjs', __FILE__)
|
||||
file = File.expand_path('../../support/custom_phantomjs_called', __FILE__)
|
||||
path = File.expand_path('../../support/custom_phantomjs', __FILE__)
|
||||
|
||||
FileUtils.rm_f file
|
||||
|
||||
driver = Capybara::Poltergeist::Driver.new(nil, :phantomjs => path)
|
||||
driver.browser
|
||||
|
||||
`ps -o command=`.should include(path)
|
||||
# If the correct custom path is called, it will touch the file. We allow at
|
||||
# least 1 sec for this to happen before failing.
|
||||
|
||||
tries = 0
|
||||
until File.exist?(file) || tries == 10
|
||||
sleep 0.1
|
||||
tries += 1
|
||||
end
|
||||
|
||||
File.exist?(file).should == true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
#!/bin/bash
|
||||
touch `dirname "$0"`/custom_phantomjs_called
|
||||
phantomjs "$@"
|
||||
|
|
Loading…
Reference in New Issue