spec: Reset DB counter in set_up, not tear_down
This avoids a problem where, if the tear_down doesn't happen (say, if the process is aborted), things wouldn't have been reset for the next run. By doing it in the set_up, we can always count on IDs starting at 1 every time the tests run. Change-Id: I90ab810c03ea7f153dabc40b346d92bb2a11726f Reviewed-on: https://gerrit.instructure.com/155194 Tested-by: Jenkins Reviewed-by: Anju Reddy <areddy@instructure.com> Product-Review: Tucker McKnight <tmcknight@instructure.com> QA-Review: Tucker McKnight <tmcknight@instructure.com>
This commit is contained in:
parent
5b6675c12a
commit
3db851750d
|
@ -24,11 +24,12 @@ end
|
|||
Pact.set_up do
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
Pact.tear_down do
|
||||
DatabaseCleaner.clean
|
||||
ActiveRecord::Base.connection.tables.each do |t|
|
||||
ActiveRecord::Base.connection.reset_pk_sequence!(t)
|
||||
end
|
||||
end
|
||||
|
||||
Pact.tear_down do
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue