Checkpoint commit.

Fleshing out collections, automatic serialization of values.  Stringify
all keys.

FossilOrigin-Name: 8bb5e27eacd18bc34b60309a03cdce31921f790c821dab89bf12cd9bfc19825d
This commit is contained in:
Mahlon E. Smith 2020-12-16 08:29:50 +00:00
parent 9f1388a8de
commit d92ba7c5eb
3 changed files with 154 additions and 24 deletions

View file

@ -17,14 +17,24 @@ RSpec.describe( MDBX::Database ) do
expect( db.closed? ).to be_truthy
end
it "closes itself automatically when used in block form" do
db = described_class.open( TEST_DATABASE.to_s ) do |db|
expect( db.closed? ).to be_falsey
end
expect( db.closed? ).to be_truthy
end
context 'an opened database' do
before( :each ) do
@db = described_class.open( TEST_DATABASE.to_s )
end
let!( :db ) { described_class.open( TEST_DATABASE.to_s ) }
after( :each ) do
@db.close
db.close
end
it "knows its own path" do
expect( db.path ).to match( %r|data/testdb$| )
end
it "fails if opened again within the same process" do
@ -36,6 +46,16 @@ RSpec.describe( MDBX::Database ) do
to raise_exception( MDBX::DatabaseError, /environment is already used/ )
end
it "defaults to the top-level namespace" do
expect( db.collection ).to be_nil
end
it "can set a collection namespace" do
db.collection( 'bucket' )
expect( db.collection ).to eq( 'bucket' )
# TODO: set/retrieve data
end
end
end