all specs pass against couchdb trunk

This commit is contained in:
Chris Anderson 2009-03-15 13:00:47 -07:00
parent 917157a0e7
commit 36c8bea453
4 changed files with 11 additions and 25 deletions

View file

@ -205,8 +205,8 @@ module CouchRest
_run_destroy_callbacks do
result = database.delete_doc(self, bulk)
if result['ok']
self['_rev'] = nil
self['_id'] = nil
self.delete('_rev')
self.delete('_id')
end
result['ok']
end

View file

@ -149,8 +149,8 @@ describe CouchRest::Database do
{"mild" => "yet local"},
{"another" => ["set","of","keys"]}
])
rs['new_revs'].each do |r|
@db.get(r['id'])
rs.each do |r|
@db.get(r['id']).rev.should == r["rev"]
end
end
@ -170,26 +170,10 @@ describe CouchRest::Database do
{"_id" => "twoB", "mild" => "yet local"},
{"another" => ["set","of","keys"]}
])
rs['new_revs'].each do |r|
@db.get(r['id'])
rs.each do |r|
@db.get(r['id']).rev.should == r["rev"]
end
end
it "in the case of an id conflict should not insert anything" do
@r = @db.save_doc({'lemons' => 'from texas', 'and' => 'how', "_id" => "oneB"})
lambda do
rs = @db.bulk_save([
{"_id" => "oneB", "wild" => "and random"},
{"_id" => "twoB", "mild" => "yet local"},
{"another" => ["set","of","keys"]}
])
end.should raise_error(RestClient::RequestFailed)
lambda do
@db.get('twoB')
end.should raise_error(RestClient::ResourceNotFound)
end
it "should empty the bulk save cache if no documents are given" do
@db.save_doc({"_id" => "bulk_cache_1", "val" => "test"}, true)
@ -593,7 +577,8 @@ describe CouchRest::Database do
@db.save_doc({'_id' => @docid, 'will-exist' => 'here'})
end
it "should fail without a rev" do
lambda{@db.move_doc @doc, @docid}.should raise_error(RestClient::RequestFailed)
@doc.delete("_rev")
lambda{@db.move_doc @doc, @docid}.should raise_error(ArgumentError)
lambda{@db.get(@r['id'])}.should_not raise_error
end
it "should succeed with a rev" do

View file

@ -224,7 +224,8 @@ describe CouchRest::Document do
@db.save_doc({'_id' => @docid, 'will-exist' => 'here'})
end
it "should fail without a rev" do
lambda{@doc.move @docid}.should raise_error(RestClient::RequestFailed)
@doc.delete("_rev")
lambda{@doc.move @docid}.should raise_error(ArgumentError)
lambda{@db.get(@resp['id'])}.should_not raise_error
end
it "should succeed with a rev" do

View file

@ -442,7 +442,7 @@ describe "ExtendedDocument" do
@dobj.destroy
@dobj.rev.should be_nil
@dobj.id.should be_nil
@dobj.save.should == true
@dobj.save.should == true
end
it "should make it go away" do
@dobj.destroy