Mongoid Cleaner

Cleaner for Mongoid with drop and truncation strategy.

View the Project on GitHub bitaculous/mongoid-cleaner

Requirements

Installation

  1. Add Mongoid Cleaner to your Gemfile:

    gem 'mongoid-cleaner', github: 'bitaculous/mongoid-cleaner'
  2. Run bundle to install all dependencies with Bundler

Usage

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

Development

Run specs with RSpec

Run rspec.

or via Guard:

$ guard -g spec

See Test Coverage

Run COVERAGE=true rspec.

Run RuboCop

Run rubocop.

To run all specs and RuboCop altogether, run rake.

Code Status

Travis CI Status Code Climate Status Test Coverage Status Gemnasium Status

Bug Reports

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.

Credits

All credits goes to team of trommsdorff + drüner, innovation + marketing consultants GmbH for MongoidCleaner, which this Gem is based on.

License

Mongoid Cleaner is released under the MIT License (MIT), see LICENSE.