Add Mysql2Adapter#truncate_table

This commit is contained in:
Kamal Fariz Mahyuddin 2010-07-27 12:18:30 +09:00 committed by Ben Mabey
parent 7e7caf9fe9
commit 1582731bb6
2 changed files with 8 additions and 2 deletions

View file

@ -18,6 +18,12 @@ module ActiveRecord
end
end
class Mysql2Adapter < AbstractAdapter
def truncate_table(table_name)
execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
end
end
class SQLite3Adapter < SQLiteAdapter
def truncate_table(table_name)
execute("DELETE FROM #{quote_table_name(table_name)};")

View file

@ -5,8 +5,8 @@ require 'database_cleaner/active_record/truncation'
module ActiveRecord
module ConnectionAdapters
[MysqlAdapter, SQLite3Adapter, JdbcAdapter, PostgreSQLAdapter].each do |adapter|
describe(adapter, "#truncate_table") do
[MysqlAdapter, Mysql2Adapter, SQLite3Adapter, JdbcAdapter, PostgreSQLAdapter].each do |adapter|
describe adapter, "#truncate_table" do
it "should truncate the table"
end
end