Sha256: f23447a1bc3bf7b18d3f6076ec03537c9ce4ffd98a3387282fcf2bf2e2688491

Contents?: true

Size: 600 Bytes

Versions: 4

Compression:

Stored size: 600 Bytes

Contents

require 'spec_helper'
describe Alf, '.connect' do

  it "recognizes an existing folder" do
    db = Alf.connect(File.dirname(__FILE__))
    db.should be_a(Alf::Database::Connection)
  end

  it "recognizes an existing folder through a Path instance" do
    db = Alf.connect(Path.dir)
    db.should be_a(Alf::Database::Connection)
  end

  it 'yields the connection if a block and returns its result' do
    seen = nil
    res  = Alf.connect(Path.dir) do |db|
      db.should be_a(Alf::Database::Connection)
      seen = db
      12
    end
    res.should eq(12)
    seen.should_not be_nil
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-core/alf/test_connect.rb
alf-core-0.14.0 spec/unit/alf-core/alf/test_connect.rb
alf-core-0.13.1 spec/unit/alf-core/alf/test_connect.rb
alf-core-0.13.0 spec/unit/alf-core/alf/test_connect.rb