Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote branch 'jonas11235/master'

  • Loading branch information...
commit 17f8913092ccab2ac0dc01e63090e683ade67bdb 2 parents 4ca07d9 + 8c9c0f3
@jeremyevans authored
Showing with 8 additions and 5 deletions.
  1. +3 −2 lib/sequel/database.rb
  2. +5 −3 spec/core/database_spec.rb
View
5 lib/sequel/database.rb
@@ -158,13 +158,14 @@ def self.connect(conn_string, opts = {}, &block)
m
end
if block
+ result = nil
begin
- yield(db = c.new(opts))
+ result = yield(db = c.new(opts))
ensure
db.disconnect if db
::Sequel::DATABASES.delete(db)
end
- nil
+ result
else
c.new(opts)
end
View
8 spec/core/database_spec.rb
@@ -794,6 +794,7 @@ def disconnect
x = nil
y = nil
z = nil
+ returnValue = 'anything'
p = proc do |c|
c.should be_a_kind_of(CCC)
@@ -802,15 +803,16 @@ def disconnect
z = y
y = x
x = c
+ returnValue
end
- Sequel::Database.connect('ccc://localhost/db', &p).should == nil
+ Sequel::Database.connect('ccc://localhost/db', &p).should == returnValue
CCC::DISCONNECTS.should == [x]
- Sequel.connect('ccc://localhost/db', &p).should == nil
+ Sequel.connect('ccc://localhost/db', &p).should == returnValue
CCC::DISCONNECTS.should == [y, x]
Sequel.send(:def_adapter_method, :ccc)
- Sequel.ccc('db', :host=>'localhost', &p).should == nil
+ Sequel.ccc('db', :host=>'localhost', &p).should == returnValue
CCC::DISCONNECTS.should == [z, y, x]
end
Please sign in to comment.
Something went wrong with that request. Please try again.