Removed model create/update callbacks and integrated with new bulk save infrastructure.
This commit is contained in:
parent
d8d5645ebd
commit
84382d8af4
5 changed files with 33 additions and 37 deletions
|
@ -53,6 +53,21 @@ describe CouchRest::Document, "saving using a database" do
|
|||
end
|
||||
end
|
||||
|
||||
describe CouchRest::Document, "bulk saving" do
|
||||
before :all do
|
||||
@db = reset_test_db!
|
||||
end
|
||||
|
||||
it "should use the document bulk save cache" do
|
||||
doc = CouchRest::Document.new({"_id" => "bulkdoc", "val" => 3})
|
||||
doc.database = @db
|
||||
doc.save(true)
|
||||
lambda { doc.database.get(doc["_id"]) }.should raise_error(RestClient::ResourceNotFound)
|
||||
doc.database.bulk_save
|
||||
doc.database.get(doc["_id"])["val"].should == doc["val"]
|
||||
end
|
||||
end
|
||||
|
||||
describe "getting from a database" do
|
||||
before(:all) do
|
||||
@db = reset_test_db!
|
||||
|
@ -93,4 +108,4 @@ describe "destroying a document from a db" do
|
|||
@doc = CouchRest::Document.new("key" => [1,2,3], :more => "values")
|
||||
lambda{@doc.destroy}.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue