Skip to content

Commit

Permalink
randomly shuffle the initial rowid for sqlite tests
Browse files Browse the repository at this point in the history
test plan: run the tests

Change-Id: If7fd4288520af765211a026ff0202b18249f86fe
Reviewed-on: https://gerrit.instructure.com/7254
Tested-by: Hudson <[email protected]>
Reviewed-by: Brian Palmer <[email protected]>
  • Loading branch information
jtolio committed Dec 5, 2011
1 parent e4ac7ce commit 8f87621
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ def truncate_table(model)
case model.connection.adapter_name
when "SQLite"
model.delete_all
begin
model.connection.execute("delete from sqlite_sequence where name='#{model.connection.quote_table_name(model.table_name)}';")
model.connection.execute("insert into sqlite_sequence (name, seq) values ('#{model.connection.quote_table_name(model.table_name)}', #{rand(100)});")
rescue
end
else
model.connection.execute("TRUNCATE TABLE #{model.connection.quote_table_name(model.table_name)}")
end
Expand Down

0 comments on commit 8f87621

Please sign in to comment.