langalex / couch_potato

ruby persistence layer for CouchDB.

langalex (author)
Wed Jul 01 01:35:35 -0700 2009
commit  c32620a38e8baca22cbe0395b779847559d21467
tree    f330839b75f82e060f961fa487b17da00e70f70e
parent  04fe64263e1e5497206727b3feebe980b394d845
couch_potato / spec / create_spec.rb
100644 23 lines (20 sloc) 0.602 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require File.dirname(__FILE__) + '/spec_helper'
 
describe "create" do
  before(:all) do
    recreate_db
  end
  describe "succeeds" do
    it "should store the class" do
      @comment = Comment.new :title => 'my_title'
      CouchPotato.database.save_document! @comment
      CouchPotato.couchrest_database.get(@comment.id)['ruby_class'].should == 'Comment'
    end
  end
  describe "fails" do
    it "should not store anything" do
      @comment = Comment.new
      CouchPotato.database.save_document @comment
      CouchPotato.couchrest_database.documents['rows'].should be_empty
    end
  end
end