Cleaner for Mongoid with drop and truncation strategy.
-
Add Mongoid Cleaner to your Gemfile:
gem 'mongoid-cleaner', github: 'bitaculous/mongoid-cleaner'
-
Run
bundle
to install all dependencies with Bundler
Mongoid::Cleaner.strategy = 'drop', { only: %w(users) }
Mongoid::Cleaner.clean
Mongoid::Cleaner.strategy = 'truncate', { except: %w(users) }
Mongoid::Cleaner.clean
With Rspec:
RSpec.configure do |config|
config.before :suite do
Mongoid::Cleaner.strategy = :drop
end
config.around :each do |example|
Mongoid::Cleaner.cleaning do
example.run
end
end
end
Run specs with RSpec
Run rspec
.
or via Guard:
$ guard -g spec
Run COVERAGE=true rspec
.
Run RuboCop
Run rubocop
.
To run all specs and RuboCop altogether, run rake
.
Github Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems here.
All credits goes to team of trommsdorff + drüner, innovation + marketing consultants GmbH for MongoidCleaner, which this Gem is based on.
Mongoid Cleaner is released under the MIT License (MIT), see LICENSE.