Skip to content

Commit

Permalink
* Sequel was holding open connection during "rake spec". Causes probl…
Browse files Browse the repository at this point in the history
…ems with single-connection DBs. Fixed.
  • Loading branch information
brasten committed Aug 23, 2010
1 parent f327d8e commit b2897ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/sequel-rails/railtie.rb
Expand Up @@ -47,13 +47,15 @@ class Railtie < Rails::Railtie
setup_controller_runtime(app)
end

initializer "sequel.connect" do |app|
Rails::Sequel.setup(Rails.env)
end

# Run setup code after_initialize to make sure all config/initializers
# are in effect once we setup the connection. This is especially necessary
# for the cascaded adapter wrappers that need to be declared before setup.

config.after_initialize do |app|
Rails::Sequel.setup(Rails.env)

::Sequel::Model.plugin :active_model
::Sequel::Model.plugin :validation_helpers

Expand Down
3 changes: 3 additions & 0 deletions lib/sequel-rails/railties/database.rake
Expand Up @@ -138,6 +138,9 @@ namespace :db do
task :prepare do
Rails.env = 'test'
Rake::Task['db:reset'].invoke()
Sequel::DATABASES.each do |db|
db.disconnect
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion sequel-rails.gemspec
Expand Up @@ -5,7 +5,7 @@

Gem::Specification.new do |s|
s.name = %q{sequel-rails}
s.version = "0.1.6"
s.version = "0.1.7"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Brasten Sager (brasten)"]
Expand Down

0 comments on commit b2897ba

Please sign in to comment.