Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #135 from twostairs/feature/testMongoDbUrlFromEnv
Browse files Browse the repository at this point in the history
Accept `MONGODB_URL` env variable for database url in tests
  • Loading branch information
Vadim Demedes committed Sep 4, 2016
2 parents 98f46c8 + aeabc44 commit 4dfbb9c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Task = require('./fixtures/models/task');
*/

function setup (test) {
test.before(() => mongorito.connect('localhost/mongorito_test'));
test.before(() => mongorito.connect((process.env.MONGO_URL ? process.env.MONGO_URL : 'localhost/mongorito_test')));

test.beforeEach(() => Account.remove());
test.beforeEach(() => Comment.remove());
Expand Down
2 changes: 1 addition & 1 deletion test/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ test('use multiple databases', async t => {
}
}

let secondaryDb = await mongorito.connect('localhost/mongorito_test_2');
let secondaryDb = await mongorito.connect((process.env.MONGO_URL ? process.env.MONGO_URL + '_2' : 'localhost/mongorito_test_2'));

class Post2 extends Model {
db () {
Expand Down

0 comments on commit 4dfbb9c

Please sign in to comment.