Specs for table truncation without id seq

This commit is contained in:
Strech (Sergey Fedorov) 2014-07-30 12:31:18 +06:00
parent 2ac03ef727
commit e6717b9449
2 changed files with 14 additions and 1 deletions

View file

@ -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

View file

@ -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