Skip to content

Instantly share code, notes, and snippets.

@miketierney
Created May 15, 2009 02:06
Show Gist options
  • Save miketierney/112023 to your computer and use it in GitHub Desktop.
Save miketierney/112023 to your computer and use it in GitHub Desktop.
def test_lists_files_and_directories
io = StringIO.new("GET /test/ HTTP/1.0\r\n\r\n")
body = "<html><head></head><body><ul style=\"list-style-type:none;margin:0;padding:0;\"><li>helper.rb</li><li>test.html</li><li>test.html.erb</li><li>test_pan_server.rb</li><li>test_pan_server_g.rb</li><li>test_pan_server_t_c_p.rb</li><li>test_request.rb</li><li>test_response.rb</li><li>test_router.rb</li></ul></body></html>"
@router.accept(io)
response = io.string.split("\r\n")
assert response.include?('HTTP/0.9 200 OK'), 'should have 200 status code'
assert response.include?('Content-Type: text/html'), "should have content type header"
assert response.include?(body), "Shoud list all the files in the test directory."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment