Sha256: 9ceebe1fa068fa5c5609237bebfd5cbfced94f881ec539c7fcd97fe01f3128ec

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 KB

Contents

describe "Store" do
  before do
    MotionPrime::Store.disconnect
  end

  after do
    File.delete(documents_path + "/nano.db") rescue nil
  end

  it "create :memory store" do
    MotionPrime::Store.disconnect
    store = MotionPrime::Store.create :memory
    store.filePath.should == ":memory:"
  end

  it "create :persistent store" do
    path = documents_path + "/nano.db"
    store = MotionPrime::Store.create :persistent, path
    store.filePath.should == path

    path = documents_path + "/nano.db"
    store = MotionPrime::Store.create :file, path
    store.filePath.should == path
  end

  it "create :temp store" do
    store = MotionPrime::Store.create :temp
    store.filePath.should == ""

    store = MotionPrime::Store.create :temporary
    store.filePath.should == ""
  end

  it "should use shared_store if a model has no store defined" do
    Autobot.store = nil
    MotionPrime::Store.connect
    Autobot.store.should.not.be.nil
    MotionPrime::Store.shared_store.should.not.be.nil
    Autobot.store.should == MotionPrime::Store.shared_store

    Autobot.store = MotionPrime::Store.create :temp
    Autobot.store.should.not == MotionPrime::Store.shared_store
  end

  it "should enable and disable debug mode" do
    MotionPrime::Store.debug = true
    @store = MotionPrime::Store.create
    MotionPrime::Store.debug = false
    @store.should.not.be.nil
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
motion-prime-0.1.7 spec/models/store_spec.rb
motion-prime-0.1.6 spec/models/store_spec.rb
motion-prime-0.1.5 spec/models/store_spec.rb
motion-prime-0.1.4 spec/models/store_spec.rb
motion-prime-0.1.3 spec/models/store_spec.rb
motion-prime-0.1.2 spec/models/store_spec.rb
motion-prime-0.1.1 spec/models/store_spec.rb