Sha256: f54be7ed650daa6af0e5a3f2b852c400dde6a6cf2fde1e8b55432893f44af911

Contents?: true

Size: 828 Bytes

Versions: 3

Compression:

Stored size: 828 Bytes

Contents

require File.dirname(__FILE__) + "/spec_helper"

describe 'Paranoia' do
  
  before(:all) do
    class Scared #< DataMapper::Base # please do not remove this
      include DataMapper::Persistence
      
      property :name, :string
      property :deleted_at, :datetime
    end
    
    Scared.auto_migrate!
  end
  
  after(:all) do
    database.table(Scared).drop!
  end
  
  it "should not be found" do
    cat = Scared.create(:name => 'bob')
    
    database.query('SELECT name FROM scareds').should have(1).entries
    
    cat2 = Scared.first(:name => 'bob')
    cat2.should_not be_nil
    cat2.should be_a_kind_of(Scared)
    
    cat.destroy!
    
    Scared.first(:name => 'bob').should be_nil
    
    Scared.first.should be_nil
    
    database.query('SELECT name FROM scareds').should have(1).entries
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datamapper-0.3.0 spec/paranoia_spec.rb
datamapper-0.3.1 spec/paranoia_spec.rb
datamapper-0.3.2 spec/paranoia_spec.rb