spec/destroy_spec.rb in langalex-couch_potato-0.1.1 vs spec/destroy_spec.rb in langalex-couch_potato-0.2.0
- old
+ new
@@ -1,16 +1,17 @@
require File.dirname(__FILE__) + '/spec_helper'
describe 'destroy' do
before(:all) do
- CouchPotato::Persistence.Db!
+ recreate_db
end
before(:each) do
- @comment = Comment.create! :title => 'title'
+ @comment = Comment.new :title => 'title'
+ CouchPotato.database.save_document! @comment
@comment_id = @comment.id
- @comment.destroy
+ CouchPotato.database.destroy_document @comment
end
it "should unset the id" do
@comment._id.should be_nil
end
@@ -19,10 +20,10 @@
@comment._rev.should be_nil
end
it "should remove the document from the database" do
lambda {
- CouchPotato::Persistence.Db.get(@comment_id).should
+ CouchPotato.couchrest_database.get(@comment_id).should
}.should raise_error(RestClient::ResourceNotFound)
end
end
\ No newline at end of file