-
Notifications
You must be signed in to change notification settings - Fork 484
/
mysql2_spec.rb
40 lines (31 loc) · 1 KB
/
mysql2_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'spec_helper'
require 'active_record'
require 'support/active_record/mysql2_setup'
require 'database_cleaner/active_record/truncation'
require 'database_cleaner/active_record/truncation/shared_mysql'
module ActiveRecord
module ConnectionAdapters
describe do
before(:all) { active_record_mysql2_setup }
let(:adapter) { Mysql2Adapter }
let(:connection) { active_record_mysql2_connection }
describe "#truncate_table" do
it "should truncate the table" do
2.times { User.create }
connection.truncate_table('users')
User.count.should == 0
end
it "should reset AUTO_INCREMENT index of table" do
2.times { User.create }
User.delete_all
connection.truncate_table('users')
User.create.id.should == 1
end
end
it_behaves_like "Fast truncation" do
let(:adapter) { Mysql2Adapter }
let(:connection) { active_record_mysql2_connection }
end
end
end
end