Sha256: 537f44c2a2201a965ef81d32a14bb9cbdcd9cf52911d5a4e763c703c28ab8037

Contents?: true

Size: 767 Bytes

Versions: 56

Compression:

Stored size: 767 Bytes

Contents

require 'epitools/ezdb'
require 'epitools/path'

class Test < Struct.new(:a, :b); end

describe Ezdb do

  attr_accessor :db

  before :each do
    @dbfile = Path["test.db"]
    @dbfile.rm if @dbfile.exists?
    @db = Ezdb.new @dbfile
  end
  
  after :each do
    @db.delete!
  end
  
  it "stores/retrieves" do
    db[1].should == nil
    db[1] = :blah
    db[1].should == :blah
    db.keys.should == [1]
    
    s = Test.new("what", true)
    db[s] = false
    db[s].should == false
  end
  
  it "handles nil extensions" do
    x = Ezdb.new "testdb"
    x[1].should == nil
    x.delete!
  end
  
  it "pushes" do
    db[:a] ||= []
    db[:a].should == []
    db[:a] << 1
    db[:a] << 2
    db[:a] << 3
    db[:a] << 4
    db[:a].should == [1,2,3,4]
  end
  
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
epitools-0.5.59 spec/ezdb_spec.rb
epitools-0.5.58 spec/ezdb_spec.rb
epitools-0.5.57 spec/ezdb_spec.rb
epitools-0.5.56 spec/ezdb_spec.rb
epitools-0.5.55 spec/ezdb_spec.rb
epitools-0.5.54 spec/ezdb_spec.rb
epitools-0.5.51 spec/ezdb_spec.rb
epitools-0.5.50 spec/ezdb_spec.rb
epitools-0.5.49 spec/ezdb_spec.rb
epitools-0.5.47 spec/ezdb_spec.rb
epitools-0.5.46 spec/ezdb_spec.rb
epitools-0.5.45 spec/ezdb_spec.rb
epitools-0.5.44 spec/ezdb_spec.rb
epitools-0.5.43 spec/ezdb_spec.rb
epitools-0.5.42 spec/ezdb_spec.rb
epitools-0.5.41 spec/ezdb_spec.rb
epitools-0.5.39 spec/ezdb_spec.rb
epitools-0.5.38 spec/ezdb_spec.rb
epitools-0.5.37 spec/ezdb_spec.rb
epitools-0.5.36 spec/ezdb_spec.rb