0.0
No release in over 3 years
Low commit activity in last 3 years
Typically one performs a database truncate (remove object from all collections) between tests but moped-cleaner only removes objects from collections that were inserted into.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
 Project Readme

moped-cleaner

Clean only models inserted when running tests with database interaction via moped

  1. The problem:
  • Database Cleaner removes all documents from all collections after each test
  1. The Solution:
  • Remove all documents from only touched collections after each test

####Installation:

# Gemfile

group :test do
  gem 'moped-cleaner'
end
# spec_helper.rb

RSpec.configure do |config|
  config.include Moped::Cleaner
  
  if defined?(Mongoid)
    Rails.application.eager_load!
    Mongoid.truncate!
  end
end

Unofficial Performance Results

# With database cleaner (Remove all models from all collections after each test
Finished in 1 minute 54.62 seconds
2780 examples, 0 failures

# After including Moped cleaner and removing database cleaner
Finished in 59.83 seconds
2784 examples, 0 failures

Contributing to moped-cleaner

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature or bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2014 Brian Norton. See LICENSE for further details.