diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-10 01:53:48 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-17 05:20:46 +0900 |
commit | fdac932707fb16b7d074b1d0bc7c255157d72675 (patch) | |
tree | 7932190a3b429886c69e3209926ce766ebce0895 /activerecord/test/cases/adapters | |
parent | 1db05065434e1b5341e6748632e310060e92b80d (diff) | |
download | rails-fdac932707fb16b7d074b1d0bc7c255157d72675.tar.gz rails-fdac932707fb16b7d074b1d0bc7c255157d72675.tar.bz2 rails-fdac932707fb16b7d074b1d0bc7c255157d72675.zip |
Extract `truncate` and `truncate_tables` into database statements
This is to easier make `truncate_tables` to bulk statements.
Diffstat (limited to 'activerecord/test/cases/adapters')
3 files changed, 0 insertions, 37 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/connection_test.rb b/activerecord/test/cases/adapters/mysql2/connection_test.rb index 3103589186..9c6566106a 100644 --- a/activerecord/test/cases/adapters/mysql2/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql2/connection_test.rb @@ -28,17 +28,6 @@ class Mysql2ConnectionTest < ActiveRecord::Mysql2TestCase end end - def test_truncate - rows = ActiveRecord::Base.connection.exec_query("select count(*) from comments") - count = rows.first.values.first - assert_operator count, :>, 0 - - ActiveRecord::Base.connection.truncate("comments") - rows = ActiveRecord::Base.connection.exec_query("select count(*) from comments") - count = rows.first.values.first - assert_equal 0, count - end - def test_no_automatic_reconnection_after_timeout assert_predicate @connection, :active? @connection.update("set @@wait_timeout=1") diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb index 40ab158c05..210758f462 100644 --- a/activerecord/test/cases/adapters/postgresql/connection_test.rb +++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb @@ -25,14 +25,6 @@ module ActiveRecord super end - def test_truncate - count = ActiveRecord::Base.connection.execute("select count(*) from comments").first["count"].to_i - assert_operator count, :>, 0 - ActiveRecord::Base.connection.truncate("comments") - count = ActiveRecord::Base.connection.execute("select count(*) from comments").first["count"].to_i - assert_equal 0, count - end - def test_encoding assert_queries(1) do assert_not_nil @connection.encoding diff --git a/activerecord/test/cases/adapters/sqlite3/connection_test.rb b/activerecord/test/cases/adapters/sqlite3/connection_test.rb deleted file mode 100644 index 3dabc8766a..0000000000 --- a/activerecord/test/cases/adapters/sqlite3/connection_test.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -require "cases/helper" - -class SQLite3ConnectionTest < ActiveRecord::SQLite3TestCase - fixtures :comments - - def test_truncate - rows = ActiveRecord::Base.connection.exec_query("select count(*) from comments") - count = rows.first.values.first - assert_operator count, :>, 0 - - ActiveRecord::Base.connection.truncate("comments") - rows = ActiveRecord::Base.connection.exec_query("select count(*) from comments") - count = rows.first.values.first - assert_equal 0, count - end -end |