Fixed a failing spec when using ruby 1.9

This commit is contained in:
Peter Gumeson 2009-05-30 14:53:55 -07:00
parent d012380b67
commit fb3c4530ed

View file

@ -258,7 +258,9 @@ describe CouchRest::Database do
@file.close
end
it "should save the attachment to a new doc" do
r = @db.put_attachment({'_id' => 'attach-this'}, 'couchdb.png', image = @file.read, {:content_type => 'image/png'})
image = @file.read
image.force_encoding('ASCII-8BIT') if image.respond_to?(:force_encoding)
r = @db.put_attachment({'_id' => 'attach-this'}, 'couchdb.png', image, {:content_type => 'image/png'})
r['ok'].should == true
doc = @db.get("attach-this")
attachment = @db.fetch_attachment(doc,"couchdb.png")