resourceful-test.js
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* resourceful-test.js: Tests for flatiron app(s) using the resourceful plugin
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var assert = require('assert'),
resourceful = require('resourceful'),
vows = require('vows');
var app = require('../../examples/resourceful-app/app');
app.config.set('database', { uri: 'http://localhost:5984/test' });
vows.describe('flatiron/plugins/resourceful').addBatch({
"A flatiron app using `flatiron.plugins.resourceful": {
topic: app,
"should extend the app correctly": function (app) {
assert.isObject(app.resources);
assert.isFunction(app.resources.Creature);
assert.isFunction(app.define);
},
"when initialized": {
topic: function () {
app.init(this.callback);
},
"it should use the correct engine": function () {
assert.equal(app.resources.Creature.engine, resourceful.engines.Memory);
},
"it should load the database config option": function () {
var resourceful = app.config.get('resourceful');
var database = app.config.get('database');
assert.equal(resourceful.uri, database.uri);
}
},
}
}).export(module);