Sha256: 7392a1634b6f90072cac7504a460fed5ff16311152f9bfb9ec5412811dbf417d

Contents?: true

Size: 1.11 KB

Versions: 17

Compression:

Stored size: 1.11 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
    expect(@comment._rev).not_to eq(old_rev)
    expect(@comment._rev).not_to be_nil
  end
  
  it "should not update created at" do
    old_created_at = @comment.created_at
    @comment.title = 'xyz'
    CouchPotato.database.save_document! @comment
    expect(@comment.created_at).to eq(old_created_at)
  end
  
  it "should update updated at" do
    old_updated_at = @comment.updated_at
    @comment.title = 'xyz'
    CouchPotato.database.save_document! @comment
    expect(@comment.updated_at).to be > old_updated_at
  end
  
  it "should update the attributes" do
    @comment.title = 'new title'
    CouchPotato.database.save_document! @comment
    expect(CouchPotato.couchrest_database.get("#{@comment.id}").title).to eq('new title')
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
couch_potato-1.18.0 spec/update_spec.rb
couch_potato-1.17.0 spec/update_spec.rb
couch_potato-1.16.0 spec/update_spec.rb
couch_potato-1.15.0 spec/update_spec.rb
couch_potato-1.14.0 spec/update_spec.rb
couch_potato-1.13.0 spec/update_spec.rb
couch_potato-1.12.1 spec/update_spec.rb
couch_potato-1.12.0 spec/update_spec.rb
couch_potato-1.11.0 spec/update_spec.rb
couch_potato-1.10.1 spec/update_spec.rb
couch_potato-1.10.0 spec/update_spec.rb
couch_potato-1.9.0 spec/update_spec.rb
couch_potato-1.7.1 spec/update_spec.rb
couch_potato-1.7.0 spec/update_spec.rb
couch_potato-1.6.5 spec/update_spec.rb
couch_potato-1.6.4 spec/update_spec.rb
couch_potato-1.6.3 spec/update_spec.rb