couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [1/4] fauxton commit: updated refs/heads/master to bfdbf11
Date Thu, 14 Jan 2016 08:38:39 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 54427aa24 -> bfdbf1121


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/test/nightwatch_tests/custom-commands/createDocument.js
----------------------------------------------------------------------
diff --git a/test/nightwatch_tests/custom-commands/createDocument.js b/test/nightwatch_tests/custom-commands/createDocument.js
index 9ef23eb..f8c72d5 100644
--- a/test/nightwatch_tests/custom-commands/createDocument.js
+++ b/test/nightwatch_tests/custom-commands/createDocument.js
@@ -12,7 +12,8 @@
 
 var util = require('util'),
     events = require('events'),
-    helpers = require('../helpers/helpers.js');
+    helpers = require('../helpers/helpers.js'),
+    request = require('request');
 
 function CreateDocument () {
   events.EventEmitter.call(this);
@@ -22,22 +23,25 @@ function CreateDocument () {
 util.inherits(CreateDocument, events.EventEmitter);
 
 CreateDocument.prototype.command = function (documentName, databaseName, docContents) {
-  var that = this,
-      nano = helpers.getNanoInstance(),
-      database = nano.use(databaseName);
+  var couchUrl = helpers.test_settings.db_url;
 
-  if (docContents === undefined) {
-    docContents = { dummyKey: "testingValue" };
+  if (!docContents) {
+    docContents = { dummyKey: 'testingValue' };
   }
-
-  database.insert(docContents, documentName, function (err, body, header) {
-
+  docContents._id = documentName;
+
+  request({
+    method: 'POST',
+    uri: couchUrl + '/' + databaseName + '?w=3',
+    body: docContents,
+    json: true
+  }, function (err, res, body) {
     if (err) {
       console.log('Error in nano CreateDocument Function: ' + documentName + ', in database:
' + databaseName, err.message);
     }
     console.log('nano  - created a doc: ' + documentName + ', in database: ' + databaseName);
-    that.emit('complete');
-  });
+    this.emit('complete');
+  }.bind(this));
 
   return this;
 };


Mime
View raw message