mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Introduce DB::ConnectionContext (#44)
* make Database a ConnectionContext. * introduce SingleConnectionContext for independant connections. * add `DB#connect` to create non pooled connections.
This commit is contained in:
parent
c63ea48748
commit
385cf70a8a
8 changed files with 115 additions and 23 deletions
|
@ -25,6 +25,25 @@ describe DB do
|
|||
connections.first.closed?.should be_true
|
||||
end
|
||||
|
||||
it "should create a connection and close it" do
|
||||
DummyDriver::DummyConnection.clear_connections
|
||||
DB.connect "dummy://localhost" do |cnn|
|
||||
cnn.should be_a(DummyDriver::DummyConnection)
|
||||
end
|
||||
connections.size.should eq(1)
|
||||
connections.first.closed?.should be_true
|
||||
end
|
||||
|
||||
it "should create a connection and wait for explicit closing" do
|
||||
DummyDriver::DummyConnection.clear_connections
|
||||
cnn = DB.connect "dummy://localhost"
|
||||
cnn.should be_a(DummyDriver::DummyConnection)
|
||||
connections.size.should eq(1)
|
||||
connections.first.closed?.should be_false
|
||||
cnn.close
|
||||
connections.first.closed?.should be_true
|
||||
end
|
||||
|
||||
it "query should close result_set" do
|
||||
with_witness do |w|
|
||||
with_dummy do |db|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue