diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-29 15:42:32 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-29 15:42:32 -0700 |
commit | 3b2a032677a2261499aa5d2de019f31f1173a858 (patch) | |
tree | 6999aa919a2c10c7833b9b29b4097bcb92fc04d4 /activerecord/test | |
parent | e5246092d1ce30961af4f7d9b5ad86071298cf1c (diff) | |
download | rails-3b2a032677a2261499aa5d2de019f31f1173a858.tar.gz rails-3b2a032677a2261499aa5d2de019f31f1173a858.tar.bz2 rails-3b2a032677a2261499aa5d2de019f31f1173a858.zip |
clearing active connections in the ConnectionManagement middleware if an exception happens
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/connection_management_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/connection_management_test.rb b/activerecord/test/cases/connection_management_test.rb index 3734f8e5f0..0d4a9a287e 100644 --- a/activerecord/test/cases/connection_management_test.rb +++ b/activerecord/test/cases/connection_management_test.rb @@ -57,6 +57,13 @@ module ActiveRecord assert ActiveRecord::Base.connection_handler.active_connections? end + def test_connections_closed_if_exception + app = Class.new(App) { def call(env); raise; end }.new + explosive = ConnectionManagement.new(app) + assert_raises(RuntimeError) { explosive.call(@env) } + assert !ActiveRecord::Base.connection_handler.active_connections? + end + test "doesn't clear active connections when running in a test case" do @env['rack.test'] = true @management.call(@env) |