A better fix for failing spec
This commit is contained in:
parent
fb3c4530ed
commit
027dd9a3ee
|
@ -252,15 +252,13 @@ describe CouchRest::Database do
|
||||||
describe "PUT attachment from file" do
|
describe "PUT attachment from file" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
filename = FIXTURE_PATH + '/attachments/couchdb.png'
|
filename = FIXTURE_PATH + '/attachments/couchdb.png'
|
||||||
@file = File.open(filename)
|
@file = File.open(filename, "rb")
|
||||||
end
|
end
|
||||||
after(:each) do
|
after(:each) do
|
||||||
@file.close
|
@file.close
|
||||||
end
|
end
|
||||||
it "should save the attachment to a new doc" do
|
it "should save the attachment to a new doc" do
|
||||||
image = @file.read
|
r = @db.put_attachment({'_id' => 'attach-this'}, 'couchdb.png', image = @file.read, {:content_type => 'image/png'})
|
||||||
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
|
r['ok'].should == true
|
||||||
doc = @db.get("attach-this")
|
doc = @db.get("attach-this")
|
||||||
attachment = @db.fetch_attachment(doc,"couchdb.png")
|
attachment = @db.fetch_attachment(doc,"couchdb.png")
|
||||||
|
|
Loading…
Reference in a new issue