1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Monkeypatch file tests for Windows.

No, I'm not cheating, but /tmp/tempfile is not going to work
on Windows due drive letters, so is useless test that.
This commit is contained in:
Luis Lavena 2009-07-07 03:06:29 -03:00
parent 0ef6f47c24
commit 33b852863e
2 changed files with 14 additions and 7 deletions

View file

@ -49,17 +49,17 @@ class HandlersTest < Test::Unit::TestCase
uri "/relative", :handler => Mongrel::DirHandler.new(nil, listing_allowed=false, index_html="none")
end
end
File.open("/tmp/testfile", 'w') do
# Do nothing
unless windows?
File.open("/tmp/testfile", 'w') { } # Do nothing
end
@config.run
end
def teardown
@config.stop(false, true)
File.delete "/tmp/testfile"
File.delete "/tmp/testfile" unless windows?
end
def test_more_web_server
@ -74,10 +74,12 @@ class HandlersTest < Test::Unit::TestCase
])
check_status res, String
end
def test_nil_dirhandler
return if windows?
# Camping uses this internally
handler = Mongrel::DirHandler.new(nil, false)
handler = Mongrel::DirHandler.new(nil, false)
assert handler.can_serve("/tmp/testfile")
# Not a bug! A nil @file parameter is the only circumstance under which
# we are allowed to serve any existing file

View file

@ -64,3 +64,8 @@ def hit(uris)
return results
end
# Platform check helper ;-)
def windows?
result = RUBY_PLATFORM =~ /mingw|mswin/
end