Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[test] changed mongodb tests to use localhost

  • Loading branch information...
commit 83b174babdd290edec7c63a0dee3fd0c4f53c595 1 parent b1fe712
Christian Howe coderarity authored
Showing with 9 additions and 17 deletions.
  1. +1 −1  lib/resourceful/engines/mongodb.js
  2. +8 −16 test/engines/mongodb.js
2  lib/resourceful/engines/mongodb.js
View
@@ -18,7 +18,7 @@ var Mongodb = exports.Mongodb = function Mongodb (config) {
this.user = config.auth ? config.auth.user : config.user || null;
this.pass = config.auth ? config.auth.pass : config.pass || null;
- this.db = new Db(config.database || resourceful.env || 'default',
+ this.db = new Db(config.database || resourceful.env || 'test',
new Server(config.host || config.uri || '127.0.0.1',
config.port || 27017));
24 test/engines/mongodb.js
View
@@ -7,12 +7,10 @@ var engine = exports;
engine.name = 'mongodb';
engine.options = {
- host: 'alex.mongohq.com',
- port: 10047,
- database: 'nodejitsudb15119137141',
- user: 'nodejitsu',
- pass: '48be573a3772606f1e03dd765ea2a2ee',
- collection: 'test'
+ database: 'test',
+ host: '127.0.0.1',
+ port: 27017,
+ collection: 'resourceful'
};
engine.load = function (resourceful, data, callback) {
@@ -21,22 +19,16 @@ engine.load = function (resourceful, data, callback) {
db.open(function (err) {
if (err) return callback(err);
-
- db.authenticate(engine.options.user, engine.options.pass, function (err, result) {
+ db.dropCollection(engine.options.collection, function (err) {
if (err) return callback(err);
- if (result !== true) return callback(new Error('Failed to authenticate.'));
- db.dropCollection(engine.options.collection, function (err) {
+ db.createCollection(engine.options.collection, function (err, collection) {
if (err) return callback(err);
- db.createCollection(engine.options.collection, function (err, collection) {
+ collection.insert(data, {safe: true}, function (err) {
if (err) return callback(err);
- collection.insert(data, {safe: true}, function (err) {
- if (err) return callback(err);
-
- return callback(null);
- });
+ return callback(null);
});
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.