0

Is there such thing as an embedded version of MongoDB suitable for use with RSpec, that can be started with a suite of tests?

In JavaLand, where I normally live when I'm not vacationing in the United States of Ruby, we are in the habit of starting portable embedded versions of database servers when we run tests, such as this Java-embeddable MongoDB.

Is there an equivalent for Ruby? Or do we always expect developers to have a local MongoDB running?

DeejUK
  • 12,891
  • 19
  • 89
  • 169
  • I'm not aware of something specific for Ruby, but the suggestions on [Embedded MongoDB when running integration tests](http://stackoverflow.com/questions/6437226/) are relevant in terms of other options. Several folks seem to be using Flapdoodle's [Embedded MongoDB](https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo) wrapper that you already pointed out. – Stennie Jan 24 '14 at 02:21

1 Answers1

2

Currently, our replica set tests use a MongoConfig test tool to bring up RS members: https://github.com/mongodb/mongo-ruby-driver/blob/1.x-stable/test/tools/mongo_config.rb

Check out this method for how to use it: https://github.com/mongodb/mongo-ruby-driver/blob/1.x-stable/test/helpers/test_unit.rb#L38-L62

We don't use it for our non-replica set tests, but I don't see why you couldn't use it yourself. I also don't see anything about Rspec in particular that would make this difficult either.

Emily S
  • 369
  • 1
  • 4