athieriot / specs2-embedmongo   0.8.0

MIT License GitHub

EmbeddedMongo connection helper for Specs2 tests suites

Scala versions: 2.12 2.11 2.10

EmbedMongo connection helper for Specs2 tests

With specs2-embedmongo you can easily use embedmongo in your specs2 tests suites

You can add the EmbedConnection trait to your tests classes and that will provide a standalone instance of a MongoDB server using this project:

By default, the test run in a isolated context. This mean that an instance of mongo it going to be started before each test example (on the port 12345) and stopped it after each.

If you change to a sequential context, the instance of mongo it going to be started only once before the test suite and stopped it after that. If you want to clean the database after each example you can add the trait CleanAfterExample.

You can change thow default values:

  • MongoDB port by overriding embedConnectionPort()
  • MongoDB version by overriding embedMongoDBVersion()

What it looks like?

Add as dependency

Modify project/Build.scala and add

"com.github.athieriot" %% "specs2-embedmongo" % "0.8.0"