Permalink
Browse files

Add coverage for request handling

  • Loading branch information...
1 parent 7375b52 commit bfec8763d714d989097f7dd563d0e26894617174 @ragaskar ragaskar committed Feb 17, 2010
Showing with 14 additions and 0 deletions.
  1. +14 −0 spec/server_spec.rb
View
@@ -45,6 +45,12 @@ def read(body)
headers["Location"].should == "/"
end
+ it "should 404 non-existent files" do
+ code, headers, body = @thin_app.call("PATH_INFO" => "/some-non-existent-file", "SCRIPT_NAME" => "xxx")
+ code.should == 404
+
+ end
+
describe "/ page" do
it "should load each js file in order" do
code, headers, body = @thin_app.call("PATH_INFO" => "/", "SCRIPT_NAME" => "xxx", "REQUEST_METHOD" => 'GET')
@@ -54,6 +60,14 @@ def read(body)
body.should include("\"/spec/file2.js")
body.should satisfy {|s| s.index("/src/file1.js") < s.index("/spec/file2.js") }
end
+
+ it "should return an empty 200 for HEAD requests to /" do
+ code, headers, body = @thin_app.call("PATH_INFO" => "/", "SCRIPT_NAME" => "xxx", "REQUEST_METHOD" => 'HEAD')
+ code.should == 200
+ headers.should == { 'Content-Type' => 'text/html' }
+ body.should == ''
+ end
+
end
end

0 comments on commit bfec876

Please sign in to comment.