Skip to content

Instantly share code, notes, and snippets.

@jacaetevha
Created May 30, 2012 13:53
Show Gist options
  • Select an option

  • Save jacaetevha/2836460 to your computer and use it in GitHub Desktop.

Select an option

Save jacaetevha/2836460 to your computer and use it in GitHub Desktop.
hooks for DatabaseCleaner in Rails
class ActiveSupport::TestCase
# ...
class << self
def startup
DatabaseCleaner.clean
end
def shutdown
DatabaseCleaner.clean
end
def suite
mysuite = super
def mysuite.run(*args)
ActiveSupport::TestCase.startup
super
ActiveSupport::TestCase.shutdown
end
mysuite
end
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment