Sha256: fb548aaa86fcf36a18f6d7f3758de1d96e68eaaa906c54a80d7e98f0d12b0f29

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe "create" do
  before(:all) do
    recreate_db
  end
  
  before(:each) do
    @comment = Comment.new :title => 'my_title'
    CouchPotato.database.save_document! @comment
  end
  
  it "should update the revision" do
    old_rev = @comment._rev
    @comment.title = 'xyz'
    CouchPotato.database.save_document! @comment
    @comment._rev.should_not == old_rev
    @comment._rev.should_not be_nil
  end
  
  it "should not update created at" do
    old_created_at = @comment.created_at
    @comment.title = 'xyz'
    CouchPotato.database.save_document! @comment
    @comment.created_at.should == old_created_at
  end
  
  it "should update updated at" do
    old_updated_at = @comment.updated_at
    @comment.title = 'xyz'
    CouchPotato.database.save_document! @comment
    @comment.updated_at.should > old_updated_at
  end
  
  it "should update the attributes" do
    @comment.title = 'new title'
    CouchPotato.database.save_document! @comment
    CouchPotato.couchrest_database.get("#{@comment.id}").title.should == 'new title'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
couch_potato-0.2.31 spec/update_spec.rb
couch_potato-0.2.30 spec/update_spec.rb
couch_potato-0.2.29 spec/update_spec.rb
couch_potato-0.2.28 spec/update_spec.rb