Skip to content

Instantly share code, notes, and snippets.

@stevehodgkiss
Forked from jnunemaker/test_helper.rb
Created December 29, 2009 18:58
Show Gist options
  • Save stevehodgkiss/265492 to your computer and use it in GitHub Desktop.
Save stevehodgkiss/265492 to your computer and use it in GitHub Desktop.
class ActiveSupport::TestCase
def setup
clear_all_collections
end
def clear_all_collections
# ruby 1.9 compatability
Dir[File.join(Rails.root, 'app/models/**/*.rb')].each do |model_path|
klass = File.basename(model_path, '.rb').classify.constantize
klass.collection.remove if klass.respond_to?(:collection)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment