Allow binary content (fixes #18)

This commit is contained in:
2012-11-02 13:17:49 +01:00
parent fa6235cd1f
commit 483523b091
3 changed files with 49 additions and 2 deletions

View File

@@ -123,6 +123,26 @@ describe "Directories" do
directory.data.to_i.must_equal object.meta['timestamp'][0].to_i
end
end
context "with binary data" do
before do
header "Content-Type", "image/jpeg; charset=binary"
filename = File.join(File.expand_path(File.dirname(__FILE__)), "fixtures", "rockrule.jpeg")
@image = File.open(filename, "r").read
put "/jimmy/tasks/jaypeg.jpg", @image
end
it "lists the binary files" do
get "/jimmy/tasks/"
last_response.status.must_equal 200
content = JSON.parse(last_response.body)
content.must_include "jaypeg.jpg"
content["jaypeg.jpg"].must_be_kind_of Integer
content["jaypeg.jpg"].to_s.length.must_equal 13
end
end
end
context "for a sub-directory" do