diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-01 14:10:04 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-01 14:10:04 -0300 |
commit | 372e28ce227f3d46604f1b11a1f6c746d227e875 (patch) | |
tree | 9710f26eae09a4b28875bf0290245d149aeaeb49 /activerecord/test/cases/adapters/sqlite3 | |
parent | b4db126d01943c59886f4d5ddfe36066d6956cd8 (diff) | |
parent | 6f16513b587a0805a23eab99d5f283476b1d6687 (diff) | |
download | rails-372e28ce227f3d46604f1b11a1f6c746d227e875.tar.gz rails-372e28ce227f3d46604f1b11a1f6c746d227e875.tar.bz2 rails-372e28ce227f3d46604f1b11a1f6c746d227e875.zip |
Merge pull request #13640 from maginatics/fix_sqlite3_ensure_master
SQLite3: Always close statements.
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test/cases/adapters/sqlite3')
-rw-r--r-- | activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb index 2630a0f3a4..e55525177f 100644 --- a/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb @@ -416,6 +416,21 @@ module ActiveRecord assert @conn.respond_to?(:disable_extension) end + def test_statement_closed + db = SQLite3::Database.new(ActiveRecord::Base. + configurations['arunit']['database']) + statement = SQLite3::Statement.new(db, + 'CREATE TABLE statement_test (number integer not null)') + statement.stubs(:step).raises(SQLite3::BusyException, 'busy') + statement.stubs(:columns).once.returns([]) + statement.expects(:close).once + SQLite3::Statement.stubs(:new).returns(statement) + + assert_raises ActiveRecord::StatementInvalid do + @conn.exec_query 'select * from statement_test' + end + end + private def assert_logged logs |