0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Bug fixes for paths / windows & tests

- removed path.join used for urls
- made sure async tests fail/timeout correctly
This commit is contained in:
Hannah Wolfe 2013-11-28 11:21:49 +00:00
parent 01736359ad
commit 76f3730427
2 changed files with 22 additions and 18 deletions

View file

@ -2,6 +2,7 @@ var _ = require('underscore'),
moment = require('moment'),
downsize = require('downsize'),
path = require('path'),
url = require('url'),
when = require('when'),
hbs = require('express-hbs'),
errors = require('../errorHandling'),
@ -243,7 +244,7 @@ coreHelpers.ghostScriptTags = function () {
scriptFiles = _.map(scriptFiles, function (fileName) {
return scriptTemplate({
source: path.join(blog.path, '/built/scripts/', fileName),
source: url.resolve(blog.path, '/built/scripts/') + fileName,
version: version
});
});
@ -311,6 +312,7 @@ coreHelpers.post_class = function (options) {
coreHelpers.ghost_head = function (options) {
/*jslint unparam:true*/
var blog = coreHelpers.ghost.blogGlobals(),
root = blog.path === '/' ? '' : blog.path,
head = [],
majorMinor = /^(\d+\.)?(\d+)/,
trimmedVersion = this.version;
@ -319,7 +321,7 @@ coreHelpers.ghost_head = function (options) {
head.push('<meta name="generator" content="Ghost ' + trimmedVersion + '" />');
head.push('<link rel="alternate" type="application/rss+xml" title="' + _.escape(blog.title) + '" href="' + path.join(blog.path, '/rss/') + '">');
head.push('<link rel="alternate" type="application/rss+xml" title="' + _.escape(blog.title) + '" href="' + root + '/rss/' + '">');
if (this.ghostRoot) {
head.push('<link rel="canonical" href="' + coreHelpers.ghost.blogGlobals().url + this.ghostRoot + '" />');
}

View file

@ -171,7 +171,7 @@ describe('Core Helpers', function () {
rendered.string.should.equal('home-template');
done();
}, done);
}).then(null, done);
});
it('can render class string for context', function (done) {
@ -191,7 +191,7 @@ describe('Core Helpers', function () {
rendered[2].string.should.equal('archive-template');
done();
});
}).then(null, done);
});
it('can render class for static page', function (done) {
@ -205,7 +205,7 @@ describe('Core Helpers', function () {
rendered.string.should.equal('home-template page');
done();
}, done);
}).then(null, done);
});
});
@ -219,7 +219,7 @@ describe('Core Helpers', function () {
should.exist(rendered);
rendered.string.should.equal('post');
done();
});
}).then(null, done);
});
it('can render featured class', function (done) {
@ -230,7 +230,7 @@ describe('Core Helpers', function () {
rendered.string.should.equal('post featured');
done();
}, done);
}).then(null, done);
});
});
@ -245,14 +245,16 @@ describe('Core Helpers', function () {
rendered.string.should.equal('<meta name="generator" content="Ghost 0.3" />\n<link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/">');
done();
});
}).then(null, done);
});
it('returns meta tag string even if version is invalid', function () {
var rendered = helpers.ghost_head.call({version: "0.9"}).then(function (rendered) {
it('returns meta tag string even if version is invalid', function (done) {
helpers.ghost_head.call({version: "0.9"}).then(function (rendered) {
should.exist(rendered);
rendered.string.should.equal('<meta name="generator" content="Ghost 0.9" />\n<link rel="alternate" type="application/rss+xml" title="Ghost" href="/rss/">');
});
done();
}).then(null, done);
});
});
@ -267,7 +269,7 @@ describe('Core Helpers', function () {
rendered.string.should.match(/<script src=".*\/shared\/vendor\/jquery\/jquery.js"><\/script>/);
done();
});
}).then(null, done);
});
});
@ -556,7 +558,7 @@ describe('Core Helpers', function () {
});
describe("has_tag helper", function (done) {
describe("has_tag helper", function () {
var tags = [{name: 'haunted'}, {name: 'ghost'}];
it('has loaded has_tag helper', function () {