spec/spec_helper.rb in net_dav-0.4.0 vs spec/spec_helper.rb in net_dav-0.4.1
- old
+ new
@@ -7,9 +7,32 @@
Spec::Runner.configure do |config|
end
+# Wait for webdav server to start up
+def wait_for_server(address)
+ server_running = false
+ dav = Net::DAV.new(address)
+ count = 0
+ while(not(server_running))
+ begin
+ sleep(0.1)
+ props = dav.propfind("/").to_s
+ if(props.match(/200 OK/))
+ server_running = true
+ else
+ warn "Webdav server should return \"200 OK\" "
+ exit(1)
+ end
+ rescue
+ count += 1
+ puts "Server not running. Retrying..." if ((count % 10) == 0)
+ end
+ end
+ dav = nil
+end
+
# Profind helper. Returns properties or error
def find_props_or_error(dav, path)
begin
return dav.propfind(path).to_s
rescue Net::HTTPServerException => e