Sha256: f4c0d2f3ad7f0f974397461d1fb50101692f3ae3eb31234c04a73e42be0a0544

Contents?: true

Size: 1.08 KB

Versions: 33

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe "create" do
  before(:all) do
    recreate_db
  end
  
  before(:each) do
    @comment = Comment.new :title => 'my_title', :updated_at => Time.now - 100
    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

33 entries across 33 versions & 3 rubygems

Version Path
couch_potato-1.4.0 spec/update_spec.rb
couch_potato-1.3.0 spec/update_spec.rb
couch_potato-1.2.0 spec/update_spec.rb
couch_potato-1.1.4 spec/update_spec.rb
couch_potato-1.1.2 spec/update_spec.rb
couch_potato-1.1.1 spec/update_spec.rb
couch_potato-1.1.0 spec/update_spec.rb
couch_potato-1.0.1 spec/update_spec.rb
couch_potato-1.0.0 spec/update_spec.rb
couch_potato-0.7.1 spec/update_spec.rb
couch_potato-0.7.0 spec/update_spec.rb
couch_potato-0.7.0.pre.1 spec/update_spec.rb
couch_potato-0.6.0 spec/update_spec.rb
couch_potato-0.5.7 spec/update_spec.rb
couch_potato-rails2-0.5.10 spec/update_spec.rb
couch_potato-rails2-0.5.9 spec/update_spec.rb
couch_potato-rails2-0.5.8 spec/update_spec.rb
couch_potato-rails2-0.5.7 spec/update_spec.rb
couch_potato-rails2-0.5.6 spec/update_spec.rb
couch_potato-0.5.6 spec/update_spec.rb