A wrapper to run mongo's mongoimport
from specs.
Add this line to your application's Gemfile:
gem 'mongo-import'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mongo-import
- Create a directory
spec/snapshots
- Run
mongoexport
and redirect to a file calleddb_name.collection_name.json
to the snapshots directory - In your
spec_helper.rb
add:
RSpec.configure do |c|
c.include MongoImport
end
- Use in your spec like a boss:
snapshot 'db_name.collection_name'
or
snapshot 'file_name', :db => 'db_name', :collection => 'collection_name', :path => 'spec/snapshots'
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request