Permalink
Browse files

[refactor] changes all _design doc tests to /design

Historically they where scatered by function, but this might make
moar sense
  • Loading branch information...
dscape committed Aug 3, 2012
1 parent f15f202 commit 3f5ee88b320d7f2994a65b20fff723ec16dda7f5
@@ -5,13 +5,13 @@ var specify = require("specify")
, nock = helpers.nock
;
-var mock = nock(helpers.couch, "doc/atomic")
- , db = nano.use("doc_atomic")
+var mock = nock(helpers.couch, "design/atomic")
+ , db = nano.use("design_atomic")
, rev
;
-specify("doc_atomic:setup", timeout, function (assert) {
- nano.db.create("doc_atomic", function (err) {
+specify("design_atomic:setup", timeout, function (assert) {
+ nano.db.create("design_atomic", function (err) {
assert.equal(err, undefined, "Failed to create database");
db.insert(
{ "updates":
@@ -32,16 +32,16 @@ specify("doc_atomic:setup", timeout, function (assert) {
});
});
-specify("doc_atomic:test", timeout, function (assert) {
+specify("design_atomic:test", timeout, function (assert) {
db.atomic("update", "inplace", "foobar",
{field: "foo", value: "bar"}, function (error, response) {
assert.equal(error, undefined, "Failed to update");
assert.equal(response.foo, "bar", "Update worked");
});
});
-specify("doc_atomic:teardown", timeout, function (assert) {
- nano.db.destroy("doc_atomic", function (err) {
+specify("design_atomic:teardown", timeout, function (assert) {
+ nano.db.destroy("design_atomic", function (err) {
assert.equal(err, undefined, "Failed to destroy database");
assert.ok(mock.isDone(), "Some mocks didn't run");
});
@@ -5,12 +5,12 @@ var specify = require('specify')
, nock = helpers.nock
;
-var mock = nock(helpers.couch, "view/compact")
- , db = nano.use("view_compact")
+var mock = nock(helpers.couch, "design/compact")
+ , db = nano.use("design_compact")
;
-specify("view_compact:setup", timeout, function (assert) {
- nano.db.create("view_compact", function (err) {
+specify("design_compact:setup", timeout, function (assert) {
+ nano.db.create("design_compact", function (err) {
assert.equal(err, undefined, "Failed to create database");
db.insert(
{ "views":
@@ -32,7 +32,7 @@ specify("view_compact:setup", timeout, function (assert) {
});
});
-specify("view_compact:test", timeout, function (assert) {
+specify("design_compact:test", timeout, function (assert) {
db.view.compact("alice", function (error) {
assert.equal(error, undefined, "Compact didn't respond");
db.view('alice','by_id', function (error, view) {
@@ -42,8 +42,8 @@ specify("view_compact:test", timeout, function (assert) {
});
});
-specify("view_compact:teardown", timeout, function (assert) {
- nano.db.destroy("view_compact", function (err) {
+specify("design_compact:teardown", timeout, function (assert) {
+ nano.db.destroy("design_compact", function (err) {
assert.equal(err, undefined, "Failed to destroy database");
assert.ok(mock.isDone(), "Some mocks didn't run");
});
@@ -6,12 +6,12 @@ var specify = require('specify')
, nock = helpers.nock
;
-var mock = nock(helpers.couch, "view/multiple")
- , db = nano.use("view_multiple")
+var mock = nock(helpers.couch, "design/multiple")
+ , db = nano.use("design_multiple")
;
-specify("view_multiple:setup", timeout, function (assert) {
- nano.db.create("view_multiple", function (err) {
+specify("design_multiple:setup", timeout, function (assert) {
+ nano.db.create("design_multiple", function (err) {
assert.equal(err, undefined, "Failed to create database");
db.insert(
{ "views":
@@ -33,7 +33,7 @@ specify("view_multiple:setup", timeout, function (assert) {
});
});
-specify("view_multiple:test", timeout, function (assert) {
+specify("design_multiple:test", timeout, function (assert) {
db.view('alice','by_id',
{ keys: ['foobar', 'barfoo'], include_docs: true }, function (err, view) {
assert.equal(err, undefined, "View didn't respond");
@@ -43,8 +43,8 @@ specify("view_multiple:test", timeout, function (assert) {
});
});
-specify("view_multiple:teardown", timeout, function (assert) {
- nano.db.destroy("view_multiple", function (err) {
+specify("design_multiple:teardown", timeout, function (assert) {
+ nano.db.destroy("design_multiple", function (err) {
assert.equal(err, undefined, "Failed to destroy database");
assert.ok(mock.isDone(), "Some mocks didn't run");
});
@@ -6,12 +6,12 @@ var specify = require('specify')
, nock = helpers.nock
;
-var mock = nock(helpers.couch, "view/query")
- , db = nano.use("view_query")
+var mock = nock(helpers.couch, "design/query")
+ , db = nano.use("design_query")
;
-specify("view_query:setup", timeout, function (assert) {
- nano.db.create("view_query", function (err) {
+specify("design_query:setup", timeout, function (assert) {
+ nano.db.create("design_query", function (err) {
assert.equal(err, undefined, "Failed to create database");
db.insert(
{ "views":
@@ -36,7 +36,7 @@ specify("view_query:setup", timeout, function (assert) {
});
});
-specify("view_query:test", timeout, function (assert) {
+specify("design_query:test", timeout, function (assert) {
db.view('people','by_name_and_city',
{key: ["Derek","San Francisco"]}, function (error, view) {
assert.equal(error, undefined, "View didn't respond");
@@ -48,8 +48,8 @@ specify("view_query:test", timeout, function (assert) {
});
});
-specify("view_query:teardown", timeout, function (assert) {
- nano.db.destroy("view_query", function (err) {
+specify("design_query:teardown", timeout, function (assert) {
+ nano.db.destroy("design_query", function (err) {
assert.equal(err, undefined, "Failed to destroy database");
assert.ok(mock.isDone(), "Some mocks didn't run");
});
@@ -6,12 +6,12 @@ var specify = require('specify')
, nock = helpers.nock
;
-var mock = nock(helpers.couch, "show/query")
- , db = nano.use("show_query")
+var mock = nock(helpers.couch, "design/show")
+ , db = nano.use("design_show")
;
-specify("show_query:setup", timeout, function (assert) {
- nano.db.create("show_query", function (err) {
+specify("design_show:setup", timeout, function (assert) {
+ nano.db.create("design_show", function (err) {
assert.equal(err, undefined, "Failed to create database");
db.insert(
{ "shows": {
@@ -42,7 +42,7 @@ specify("show_query:setup", timeout, function (assert) {
});
});
-specify("show_query:test", timeout, function (assert) {
+specify("design_show:test", timeout, function (assert) {
db.show('people','singleDoc', 'p_clemens', function (error, doc, rh) {
assert.equal(error, undefined, "Show function didn't respond");
assert.equal(rh['content-type'], 'application/json');
@@ -57,8 +57,8 @@ specify("show_query:test", timeout, function (assert) {
});
});
-specify("show_query:teardown", timeout, function (assert) {
- nano.db.destroy("show_query", function (err) {
+specify("design_show:teardown", timeout, function (assert) {
+ nano.db.destroy("design_show", function (err) {
assert.equal(err, undefined, "Failed to destroy database");
assert.ok(mock.isDone(), "Some mocks didn't run");
});
@@ -1,28 +1,28 @@
[
{ "method" : "put"
- , "path" : "/doc_atomic"
+ , "path" : "/design_atomic"
, "status" : 201
, "response" : "{ \"ok\": true }"
}
, { "method" : "put"
- , "path" : "/doc_atomic/_design/update"
+ , "path" : "/design_atomic/_design/update"
, "body" : "*"
, "status" : 201
, "response" : "{\"ok\":true,\"id\":\"_design/update\",\"rev\":\"1-14e6bc\"}"
}
, { "method" : "put"
, "status" : 201
- , "path" : "/doc_atomic/foobar"
+ , "path" : "/design_atomic/foobar"
, "body" : "{\"foo\":\"baz\"}"
, "response" : "{\"ok\":true,\"id\":\"foobar\",\"rev\":\"1-611488\"}"
}
, { "method" : "put"
- , "path" : "/doc_atomic/_design/update/_update/inplace/foobar"
+ , "path" : "/design_atomic/_design/update/_update/inplace/foobar"
, "body" : "{\"field\":\"foo\",\"value\":\"bar\"}"
, "response" : "{\"foo\": \"bar\"}"
}
, { "method" : "delete"
- , "path" : "/doc_atomic"
+ , "path" : "/design_atomic"
, "response" : "{ \"ok\": true }"
}
]
@@ -1,35 +1,35 @@
[
{ "method" : "put"
- , "path" : "/view_compact"
+ , "path" : "/design_compact"
, "status" : 201
, "response" : "{ \"ok\": true }"
}
, { "method" : "put"
- , "path" : "/view_compact/_design/alice"
+ , "path" : "/design_compact/_design/alice"
, "body" : "{\"views\":{\"by_id\":{\"map\":\"function (doc) { emit(doc._id, doc); }\"}}}"
, "status" : 201
, "response" : "{\"ok\":true,\"id\":\"_design/alice\",\"rev\":\"1-14e6bc\"}"
}
, { "method" : "put"
, "status" : 201
- , "path" : "/view_compact/foobaz"
+ , "path" : "/design_compact/foobaz"
, "body" : "{\"foo\":\"baz\"}"
, "response" : "{\"ok\":true,\"id\":\"foobaz\",\"rev\":\"1-611488\"}"
}
, { "method" : "delete"
- , "path" : "/view_compact/foobaz?rev=1-611488"
+ , "path" : "/design_compact/foobaz?rev=1-611488"
, "response" : "{\"ok\":true}"
}
, { "method" : "post"
- , "path" : "/view_compact/_compact/alice"
+ , "path" : "/design_compact/_compact/alice"
, "response" : "{\"ok\":true}"
, "status" : 202
}
-, { "path" : "/view_compact/_design/alice/_view/by_id"
+, { "path" : "/design_compact/_design/alice/_view/by_id"
, "response" : "{ \"total_rows\": 0, \"offset\": 0, \"rows\": [] }"
}
, { "method" : "delete"
- , "path" : "/view_compact"
+ , "path" : "/design_compact"
, "response" : "{ \"ok\": true }"
}
]
@@ -1,40 +1,40 @@
[
{ "method" : "put"
- , "path" : "/view_multiple"
+ , "path" : "/design_multiple"
, "status" : 201
, "response" : "{ \"ok\": true }"
}
, { "method" : "put"
- , "path" : "/view_multiple/_design/alice"
+ , "path" : "/design_multiple/_design/alice"
, "body" : "{\"views\":{\"by_id\":{\"map\":\"function (doc) { emit(doc._id, doc); }\"}}}"
, "status" : 201
, "response" : "{\"ok\":true,\"id\":\"_design/alice\",\"rev\":\"1-14e6bc\"}"
}
, { "method" : "put"
, "status" : 201
- , "path" : "/view_multiple/foobar"
+ , "path" : "/design_multiple/foobar"
, "body" : "{\"foo\":\"bar\"}"
, "response" : "{\"ok\":true,\"id\":\"foobar\",\"rev\":\"1-4c6114\"}"
}
, { "method" : "put"
, "status" : 201
- , "path" : "/view_multiple/foobaz"
+ , "path" : "/design_multiple/foobaz"
, "body" : "{\"foo\":\"baz\"}"
, "response" : "{\"ok\":true,\"id\":\"foobaz\",\"rev\":\"1-611488\"}"
}
, { "method" : "put"
, "status" : 201
- , "path" : "/view_multiple/barfoo"
+ , "path" : "/design_multiple/barfoo"
, "body" : "{\"bar\":\"foo\"}"
, "response" : "{\"ok\":true,\"id\":\"barfoo\",\"rev\":\"1-3cde10\"}"
}
-, { "path" : "/view_multiple/_design/alice/_view/by_id?include_docs=true"
+, { "path" : "/design_multiple/_design/alice/_view/by_id?include_docs=true"
, "body" : "{\"keys\":[\"foobar\",\"barfoo\"]}"
, "method" : "post"
, "response" : "{\"total_rows\":3,\"offset\":2,\"rows\":[\r\n{\"id\":\"foobar\",\"key\":\"foobar\",\"value\":{\"_id\":\"foobar\",\"_rev\":\"1-4c6114c65e295552ab1019e2b046b10e\",\"foo\":\"bar\"},\"doc\":{\"_id\":\"foobar\",\"_rev\":\"1-4c6114c65e295552ab1019e2b046b10e\",\"foo\":\"bar\"}},\r\n{\"id\":\"barfoo\",\"key\":\"barfoo\",\"value\":{\"_id\":\"barfoo\",\"_rev\":\"1-41412c293dade3fe73279cba8b4cece4\",\"bar\":\"foo\"},\"doc\":{\"_id\":\"barfoo\",\"_rev\":\"1-41412c293dade3fe73279cba8b4cece4\",\"bar\":\"foo\"}}\r\n]}\n"
}
, { "method" : "delete"
- , "path" : "/view_multiple"
+ , "path" : "/design_multiple"
, "status" : 200
, "response" : "{ \"ok\": true }"
}
@@ -1,38 +1,38 @@
[
{ "method" : "put"
- , "path" : "/view_query"
+ , "path" : "/design_query"
, "status" : 201
, "response" : "{ \"ok\": true }"
}
, { "method" : "put"
- , "path" : "/view_query/_design/people"
+ , "path" : "/design_query/_design/people"
, "body" : "{\"views\":{\"by_name_and_city\":{\"map\":\"function (doc) { emit([doc.name, doc.city], doc._id); }\"}}}"
, "status" : 201
, "response" : "{\"ok\":true,\"id\":\"_design/people\",\"rev\":\"1-14e6bc\"}"
}
, { "method" : "put"
, "status" : 201
- , "path" : "/view_query/p_derek"
+ , "path" : "/design_query/p_derek"
, "body" : "{\"name\":\"Derek\",\"city\":\"San Francisco\"}"
, "response" : "{\"ok\":true,\"id\":\"p_derek\",\"rev\":\"1-4c6114\"}"
}
, { "method" : "put"
, "status" : 201
- , "path" : "/view_query/p_randall"
+ , "path" : "/design_query/p_randall"
, "body" : "{\"name\":\"Randall\",\"city\":\"San Francisco\"}"
, "response" : "{\"ok\":true,\"id\":\"p_randall\",\"rev\":\"1-4c6114\"}"
}
, { "method" : "put"
, "status" : 201
- , "path" : "/view_query/p_nuno"
+ , "path" : "/design_query/p_nuno"
, "body" : "{\"name\":\"Nuno\",\"city\":\"New York\"}"
, "response" : "{\"ok\":true,\"id\":\"p_nuno\",\"rev\":\"1-4c6114\"}"
}
-, { "path" : "/view_query/_design/people/_view/by_name_and_city?key=%5B%22Derek%22%2C%22San%20Francisco%22%5D"
+, { "path" : "/design_query/_design/people/_view/by_name_and_city?key=%5B%22Derek%22%2C%22San%20Francisco%22%5D"
, "response" : "{\"total_rows\":3,\"offset\":0,\"rows\":[\r\n{\"id\":\"p_derek\",\"key\":[\"Derek\",\"San Francisco\"],\"value\":\"p_derek\"}\r\n]}\n"
}
, { "method" : "delete"
- , "path" : "/view_query"
+ , "path" : "/design_query"
, "status" : 200
, "response" : "{ \"ok\": true }"
}
Oops, something went wrong.

0 comments on commit 3f5ee88

Please sign in to comment.