Sha256: c412a8505c0f98bad3c4e23ad392cc38df844d5bb3c208a33ff7752ff323f276

Contents?: true

Size: 1.36 KB

Versions: 12

Compression:

Stored size: 1.36 KB

Contents

describe "Model 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

12 entries across 12 versions & 1 rubygems

Version Path
motion-prime-0.4.5 spec/models/store_spec.rb
motion-prime-0.4.4 spec/models/store_spec.rb
motion-prime-0.4.3 spec/models/store_spec.rb
motion-prime-0.4.2 spec/models/store_spec.rb
motion-prime-0.4.1 spec/models/store_spec.rb
motion-prime-0.4.0 spec/models/store_spec.rb
motion-prime-0.3.3 spec/models/store_spec.rb
motion-prime-0.3.2 spec/models/store_spec.rb
motion-prime-0.3.1 spec/models/store_spec.rb
motion-prime-0.3.0 spec/models/store_spec.rb
motion-prime-0.2.1 spec/models/store_spec.rb
motion-prime-0.2.0 spec/models/store_spec.rb