mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
Specs for table truncation without id seq
This commit is contained in:
parent
2ac03ef727
commit
e6717b9449
2 changed files with 14 additions and 1 deletions
|
@ -27,6 +27,13 @@ module ActiveRecord
|
|||
User.count.should eq 0
|
||||
end
|
||||
|
||||
it "truncates the table without id sequence" do
|
||||
2.times { Agent.create }
|
||||
|
||||
connection.truncate_table('agents')
|
||||
Agent.count.should eq 0
|
||||
end
|
||||
|
||||
it "resets AUTO_INCREMENT index of table" do
|
||||
2.times { User.create }
|
||||
User.delete_all
|
||||
|
@ -45,4 +52,3 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,8 +3,15 @@ def load_schema
|
|||
create_table :users, :force => true do |t|
|
||||
t.integer :name
|
||||
end
|
||||
|
||||
create_table :agents, :id => false, :force => true do |t|
|
||||
t.integer :name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class ::User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
class ::Agent < ActiveRecord::Base
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue