Add a test to complete code coverage.
FossilOrigin-Name: c8ac76905df042f626c4a2a4bac2512f489b520150b12d661ecf9d8fdb10e248
This commit is contained in:
parent
07ab25d126
commit
cfc0b7c301
1 changed files with 9 additions and 0 deletions
|
|
@ -236,6 +236,15 @@ RSpec.describe( MDBX::Database ) do
|
||||||
expect( db.collection ).to eq( 'bucket' )
|
expect( db.collection ).to eq( 'bucket' )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "ensures transactions have closed if deserialization fails" do
|
||||||
|
db.deserializer = ->( v ) { raise "ka-bloooey!" }
|
||||||
|
db['foo'] = 1
|
||||||
|
expect {
|
||||||
|
db.transaction { db['foo'] }
|
||||||
|
}.to raise_error( RuntimeError, /ka-bloooey!/ )
|
||||||
|
expect( db.in_transaction? ).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
it "revert back to the previous collection when used in a block" do
|
it "revert back to the previous collection when used in a block" do
|
||||||
expect( db.collection ).to be_nil
|
expect( db.collection ).to be_nil
|
||||||
db.collection( 'bucket' ) { 'no-op' }
|
db.collection( 'bucket' ) { 'no-op' }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue