Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
etehtsea authored and ches committed Jun 26, 2011
1 parent 2a268e1 commit 8dd6e8c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rack/gridfs.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'mongo' require 'mongo'
require 'mime/types' require 'mime/types'
require 'cgi'


module Rack module Rack
class GridFSConnectionError < StandardError ; end class GridFSConnectionError < StandardError ; end
Expand Down
1 change: 1 addition & 0 deletions test/artifacts/тест.txt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
Lorem ipsum dolor sit amet.
8 changes: 8 additions & 0 deletions test/gridfs_test.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'test_helper' require 'test_helper'
require 'pp' require 'pp'


Expand Down Expand Up @@ -159,6 +161,12 @@ def app; setup_endpoint(:lookup => :path) end
assert_equal 'text/plain', last_response.content_type assert_equal 'text/plain', last_response.content_type
end end


should "return TXT with non-ascii filename files stored in GridFS" do
@rus_text_file = load_artifact('тест.txt', nil, path='text')
get "/gridfs/#{CGI::escape(@rus_text_file.filename)}"
assert_equal "Lorem ipsum dolor sit amet.", last_response.body
end

should "return a not found for a unknown path" do should "return a not found for a unknown path" do
get '/gridfs/unknown' get '/gridfs/unknown'
assert last_response.not_found? assert last_response.not_found?
Expand Down

0 comments on commit 8dd6e8c

Please sign in to comment.