make qunit at least wait for a network connection

This commit is contained in:
Sam 2013-07-30 12:32:12 +10:00
parent 8ec6d0ea6c
commit 85ddf73cf3
1 changed files with 11 additions and 3 deletions

View File

@ -20,14 +20,22 @@ task "qunit:test" => :environment do
test_path = "#{Rails.root}/vendor/assets/javascripts"
cmd = "phantomjs #{test_path}/run-qunit.js \"http://localhost:#{port}/qunit\""
rake_system(cmd)
# wait for server to respond, will exception out on failure
tries = 0
begin
rake_system(cmd)
rescue
sleep 1
tries += 1
retry unless tries == 5
end
# A bit of a hack until we can figure this out on Travis
tries = 0
while tries < 3 && $?.exitstatus === 124
tries += 1
puts "\nTimed Out. Trying again...\n"
sh(cmd)
rake_system(cmd)
end
success &&= $?.success?
@ -43,4 +51,4 @@ task "qunit:test" => :environment do
exit(1)
end
end
end