Sha256: ab671b21855bc2454d0863f6d2bbe57608385f4ead047641db5769a4a1f3d15d

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe "create" do
  before(:each) 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).send(JSON.create_id).should == 'Comment'
    end
    
    it "should persist a given created_at" do
      @comment = Comment.new :created_at => Time.parse('2010-01-02 12:34:48 +0000'), :title => '-'
      CouchPotato.database.save_document! @comment
      CouchPotato.couchrest_database.get(@comment.id).created_at.should == Time.parse('2010-01-02 12:34:48 +0000')
    end
    
    it "should persist a given updated_at" do
      @comment = Comment.new :updated_at => Time.parse('2010-01-02 12:34:48 +0000'), :title => '-'
      CouchPotato.database.save_document! @comment
      CouchPotato.couchrest_database.get(@comment.id).updated_at.should == Time.parse('2010-01-02 12:34:48 +0000')
    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

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
couch_potato-0.6.0 spec/create_spec.rb
couch_potato-0.5.7 spec/create_spec.rb
couch_potato-rails2-0.5.10 spec/create_spec.rb
couch_potato-rails2-0.5.9 spec/create_spec.rb
couch_potato-rails2-0.5.8 spec/create_spec.rb
couch_potato-rails2-0.5.7 spec/create_spec.rb
couch_potato-rails2-0.5.6 spec/create_spec.rb
couch_potato-0.5.6 spec/create_spec.rb
couch_potato-0.5.5 spec/create_spec.rb
couch_potato-0.5.4 spec/create_spec.rb
couch_potato-0.5.3 spec/create_spec.rb
couch_potato-0.5.2 spec/create_spec.rb
couch_potato-0.5.1 spec/create_spec.rb
couch_potato-0.5.0 spec/create_spec.rb