slight change of API, CR::Document now uses <action>_doc instead of <action>, also added #create! and #recreate! to Document instances
This commit is contained in:
parent
e9f7456eab
commit
fda5be213a
8 changed files with 185 additions and 108 deletions
|
@ -275,7 +275,7 @@ describe CouchRest::Model do
|
|||
}
|
||||
]
|
||||
}
|
||||
r = Course.database.save course_doc
|
||||
r = Course.database.save_doc course_doc
|
||||
@course = Course.get r['id']
|
||||
end
|
||||
it "should load the course" do
|
||||
|
@ -336,7 +336,7 @@ describe CouchRest::Model do
|
|||
},
|
||||
"final_test_at" => "2008/12/19 13:00:00 +0800"
|
||||
}
|
||||
r = Course.database.save course_doc
|
||||
r = Course.database.save_doc course_doc
|
||||
@course = Course.get r['id']
|
||||
end
|
||||
it "should load the course" do
|
||||
|
@ -353,7 +353,7 @@ describe CouchRest::Model do
|
|||
describe "cast keys to any type" do
|
||||
before(:all) do
|
||||
event_doc = { :subject => "Some event", :occurs_at => Time.now }
|
||||
e = Event.database.save event_doc
|
||||
e = Event.database.save_doc event_doc
|
||||
|
||||
@event = Event.get e['id']
|
||||
end
|
||||
|
@ -408,7 +408,7 @@ describe CouchRest::Model do
|
|||
before(:each) do
|
||||
@art = Article.new
|
||||
@old = Article.database.get('this-is-the-title') rescue nil
|
||||
Article.database.delete(@old) if @old
|
||||
Article.database.delete_doc(@old) if @old
|
||||
end
|
||||
|
||||
it "should be a new document" do
|
||||
|
@ -538,7 +538,7 @@ describe CouchRest::Model do
|
|||
end
|
||||
|
||||
it "should not include non-Articles" do
|
||||
Article.database.save({"date" => 1})
|
||||
Article.database.save_doc({"date" => 1})
|
||||
view = Article.by_date :raw => true
|
||||
view['rows'].length.should == 4
|
||||
end
|
||||
|
@ -591,7 +591,7 @@ describe CouchRest::Model do
|
|||
|
||||
describe "a ducktype view" do
|
||||
before(:all) do
|
||||
@id = @db.save({:dept => true})['id']
|
||||
@id = @db.save_doc({:dept => true})['id']
|
||||
end
|
||||
it "should setup" do
|
||||
duck = Course.get(@id) # from a different db
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue