Sha256: fb96b265bcfa77e1545f39be94a1c81d3689e43e68c4e8a04d89b0928bc790ca

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

describe NanoStore do
  class Spaceship < NanoStore::Model
    attribute :name
  end

  it "create :memory store" do
    store = NanoStore.store
    store.filePath.should == ":memory:"

    store = NanoStore.store :memory
    store.filePath.should == ":memory:"
  end
  
  it "create :persistent store" do
    path = App.documents_path + "/nano.db"
    store = NanoStore.store :persistent, path
    store.filePath.should == path    

    path = App.documents_path + "/nano.db"
    store = NanoStore.store :file, path
    store.filePath.should == path
  end
  
  it "create :temp store" do
    store = NanoStore.store :temp
    store.filePath.should == ""

    store = NanoStore.store :temporary
    store.filePath.should == ""
  end

  it "should use shared_store if a model has no store defined" do  
    NanoStore.shared_store = NanoStore.store
    Spaceship.store.should.not.be.nil
    NanoStore.shared_store.should.not.be.nil
    Spaceship.store.should == NanoStore.shared_store

    Spaceship.store = NanoStore.store :temp
    Spaceship.store.should.not == NanoStore.shared_store
  end
  
  it "should enable and disable debug mode" do
    NanoStore.debug = true    
    NanoStore.shared_store = NanoStore.store    
    NanoStore.debug = false
    NanoStore.shared_store.should.not.be.nil
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nano-store-0.4.3 spec/nano_store_spec.rb
nano-store-0.4.2 spec/nano_store_spec.rb
nano-store-0.4.1 spec/nano_store_spec.rb
nano-store-0.4.0 spec/nano_store_spec.rb
nano-store-0.3.14 spec/nano_store_spec.rb
nano-store-0.3.13 spec/nano_store_spec.rb