mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
using grunt validate for npm test, fixing random jslint errors
This commit is contained in:
parent
a3d2fb7aa9
commit
4a318e9a6a
10 changed files with 23 additions and 23 deletions
|
@ -64,7 +64,7 @@
|
|||
console.log('user found: ', user);
|
||||
req.session.user = "ghostadmin";
|
||||
res.redirect(req.query.redirect || '/ghost/');
|
||||
}, function(err) {
|
||||
}, function (err) {
|
||||
// Do something here to signal the reason for an error
|
||||
console.log(err.stack);
|
||||
res.redirect('/ghost/login/');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var _ = require('underscore'),
|
||||
|
@ -8,7 +8,7 @@
|
|||
* Basic error handling helpers
|
||||
*/
|
||||
errors = {
|
||||
throwError: function(err) {
|
||||
throwError: function (err) {
|
||||
if (!err) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
// Simple bootstraping of the data model for now.
|
||||
var migration = require('../data/migration/001');
|
||||
|
||||
migration.down().then(function() {
|
||||
migration.up().then(function () {
|
||||
console.log('all done....');
|
||||
});
|
||||
return migration.down().then(function () {
|
||||
return migration.up();
|
||||
});
|
||||
}).then(function () {
|
||||
console.log('all done....');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var util = require('util'),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var _ = require('underscore'),
|
||||
|
@ -17,7 +17,7 @@
|
|||
|
||||
util.inherits(SettingsProvider, BaseProvider);
|
||||
|
||||
SettingsProvider.prototype.read = function(_key) {
|
||||
SettingsProvider.prototype.read = function (_key) {
|
||||
// Allow for just passing the key instead of attributes
|
||||
if (_.isString(_key)) {
|
||||
_key = { key: _key };
|
||||
|
@ -25,7 +25,7 @@
|
|||
return BaseProvider.prototype.read.call(this, _key);
|
||||
};
|
||||
|
||||
SettingsProvider.prototype.edit = function(_data) {
|
||||
SettingsProvider.prototype.edit = function (_data) {
|
||||
return when.all(_.map(_data, function (value, key) {
|
||||
return this.model.forge({ key: key }).fetch().then(function (setting) {
|
||||
return setting.set('value', value).save();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var util = require('util'),
|
||||
|
@ -30,7 +30,7 @@
|
|||
// Clone the _user so we don't expose the hashed password unnecessarily
|
||||
userData = _.extend({}, _user);
|
||||
|
||||
return nodefn.call(bcrypt.hash, _user.password, 10).then(function(hash) {
|
||||
return nodefn.call(bcrypt.hash, _user.password, 10).then(function (hash) {
|
||||
userData.password = hash;
|
||||
return BaseProvider.prototype.add.call(self, userData);
|
||||
});
|
||||
|
@ -46,7 +46,7 @@
|
|||
return this.model.forge({
|
||||
email_address: _userdata.email
|
||||
}).fetch().then(function (user) {
|
||||
return nodefn.call(bcrypt.compare, _userdata.pw, user.get('password')).then(function(matched) {
|
||||
return nodefn.call(bcrypt.compare, _userdata.pw, user.get('password')).then(function (matched) {
|
||||
if (!matched) {
|
||||
return when.reject(new Error('Password does not match'));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
DataProvider.prototype.globals.data = [];
|
||||
|
||||
|
||||
DataProvider.prototype.globals.findAll = function() {
|
||||
DataProvider.prototype.globals.findAll = function () {
|
||||
return when(this.data);
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
errors.throwError(toThrow);
|
||||
};
|
||||
|
||||
runThrowError.should.throw("test1");
|
||||
runThrowError.should['throw']("test1");
|
||||
});
|
||||
|
||||
it("throws error strings", function () {
|
||||
|
@ -28,7 +28,7 @@
|
|||
errors.throwError(toThrow);
|
||||
};
|
||||
|
||||
runThrowError.should.throw("test2");
|
||||
runThrowError.should['throw']("test2");
|
||||
});
|
||||
|
||||
it("logs errors", function () {
|
||||
|
@ -52,7 +52,7 @@
|
|||
logStub.restore();
|
||||
});
|
||||
|
||||
it("logs promise errors with custom messages", function(done) {
|
||||
it("logs promise errors with custom messages", function (done) {
|
||||
var def = when.defer(),
|
||||
prom = def.promise,
|
||||
logStub = sinon.stub(console, "log");
|
||||
|
@ -71,12 +71,12 @@
|
|||
def.reject();
|
||||
});
|
||||
|
||||
it("logs promise errors and redirects", function(done) {
|
||||
it("logs promise errors and redirects", function (done) {
|
||||
var def = when.defer(),
|
||||
prom = def.promise,
|
||||
req = null,
|
||||
res = {
|
||||
redirect: function() {
|
||||
redirect: function () {
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Use 'testing' Ghost config
|
||||
|
@ -13,7 +13,7 @@
|
|||
resetData: function () {
|
||||
return migrations.one.down().then(function () {
|
||||
return migrations.one.up();
|
||||
}, function() {
|
||||
}, function () {
|
||||
throw new Error("Failed to reset data");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node app",
|
||||
"test": "mocha core/test/ghost"
|
||||
"test": "grunt validate"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "3.1.x",
|
||||
|
|
Loading…
Add table
Reference in a new issue