Skip to content

Commit

Permalink
(#3535) - Document and alias skipSetup (skip_setup)
Browse files Browse the repository at this point in the history
  • Loading branch information
janraasch authored and daleharvey committed Sep 16, 2015
1 parent eeb6a24 commit d176073
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/_includes/api/create_database.html
Expand Up @@ -21,6 +21,7 @@
* `ajax.cache`: Appends a random string to the end of all HTTP GET requests to avoid them being cached on IE. Set this to `true` to prevent this happening.
* `ajax.headers`: The `ajax.headers` option allows you to customise headers that are sent to the remote HTTP Server.
* `auth.username` + `auth.password`: You can specify HTTP auth parameters either by using a database with a name in the form `http://user:pass@host/name` or via the `auth.username` + `auth.password` options.
* `skip_setup`: Initially PouchDB checks if the database exists, and tries to create it, if it does not exist yet. Set this to `true` to skip this setup.

**WebSQL-only options:**

Expand Down
4 changes: 2 additions & 2 deletions lib/adapters/http/index.js
Expand Up @@ -172,8 +172,8 @@ function HttpPouch(opts, callback) {
var setupPromise;

function setup() {

if (opts.skipSetup) {
// TODO: Remove `skipSetup` in favor of `skip_setup` in a future release
if (opts.skipSetup || opts.skip_setup) {
return Promise.resolve();
}

Expand Down
23 changes: 21 additions & 2 deletions tests/integration/test.http.js
Expand Up @@ -13,8 +13,8 @@ describe('test.http.js', function () {
testUtils.cleanup([dbs.name], done);
});


it('Create a pouch without DB setup', function (done) {
// TODO: Remove `skipSetup` in favor of `skip_setup` in a future release
it('Create a pouch without DB setup (skipSetup)', function (done) {
var instantDB;
testUtils.isCouchDB(function (isCouchDB) {
if (!isCouchDB) {
Expand All @@ -33,6 +33,25 @@ describe('test.http.js', function () {
});
});

it('Create a pouch without DB setup (skip_setup)', function (done) {
var instantDB;
testUtils.isCouchDB(function (isCouchDB) {
if (!isCouchDB) {
return done();
}
new PouchDB(dbs.name).then(function (db) {
db.destroy(function () {
instantDB = new PouchDB(dbs.name, { skip_setup: true });
instantDB.post({ test: 'abc' }, function (err, info) {
should.exist(err);
err.name.should.equal('not_found', 'Skipped setup of database');
done();
});
});
});
});
});

it('Issue 1269 redundant _changes requests', function (done) {
var docs = [];
var num = 100;
Expand Down

0 comments on commit d176073

Please sign in to comment.