Sha256: 69f34f32d3e1c54bc292afa487a93d0173a5130e45bb5baa00ea47888447be9f

Contents?: true

Size: 1.08 KB

Versions: 20

Compression:

Stored size: 1.08 KB

Contents

require File.dirname(__FILE__) + '/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

20 entries across 20 versions & 5 rubygems

Version Path
andrewtimberlake-couch_potato-0.2.8.1 spec/update_spec.rb
andrewtimberlake-couch_potato-0.2.8.2 spec/update_spec.rb
andrewtimberlake-couch_potato-0.2.8.3 spec/update_spec.rb
andrewtimberlake-couch_potato-0.2.8.4 spec/update_spec.rb
langalex-couch_potato-0.2.0 spec/update_spec.rb
langalex-couch_potato-0.2.1 spec/update_spec.rb
langalex-couch_potato-0.2.11 spec/update_spec.rb
langalex-couch_potato-0.2.12 spec/update_spec.rb
langalex-couch_potato-0.2.2 spec/update_spec.rb
langalex-couch_potato-0.2.3 spec/update_spec.rb
langalex-couch_potato-0.2.4 spec/update_spec.rb
langalex-couch_potato-0.2.5 spec/update_spec.rb
langalex-couch_potato-0.2.6 spec/update_spec.rb
langalex-couch_potato-0.2.7 spec/update_spec.rb
langalex-couch_potato-0.2.8 spec/update_spec.rb
langalex-couch_potato-0.2.9 spec/update_spec.rb
speedmax-couch_potato-0.2.0 spec/update_spec.rb
speedmax-couch_potato-0.2.2 spec/update_spec.rb
thefool808-couch_potato-0.2.7 spec/update_spec.rb
couch_potato-0.2.12 spec/update_spec.rb