Permalink
Browse files

Handle unknown keys and images.

  • Loading branch information...
1 parent 07d0eae commit 701582490fa5a4324023b3ad5f5c7805874154b9 @skinandbones committed Sep 21, 2009
Showing with 18 additions and 0 deletions.
  1. BIN test/artifacts/3wolfmoon.jpg
  2. +18 −0 test/rack/gridfs_test.rb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -123,6 +123,24 @@ def load_artifact(filename, key, content_type)
get '/gridfs/test.html'
assert_equal 'text/html', last_response.content_type
end
+
+ should "return a not found for a unknown path" do
+ get '/gridfs/unknown'
+ assert last_response.not_found?
+ end
+
+ should "handle complex file paths" do
+ load_artifact('test.html', 'stuff/187d/foo.html', 'text/html')
+ get '/gridfs/stuff/187d/foo.html'
+ assert_equal 'text/html', last_response.content_type
+ end
+
+ should "work for small images" do
+ load_artifact('3wolfmoon.jpg', 'images/3wolfmoon.jpg', 'image/jpeg')
+ get '/gridfs/images/3wolfmoon.jpg'
+ assert last_response.ok?
+ assert_equal 'image/jpeg', last_response.content_type
+ end
end
end

0 comments on commit 7015824

Please sign in to comment.