Fix failing frontend_spec on windows. Don't rely on path matches.

This commit is contained in:
Fabian Becker 2015-07-14 11:16:41 +02:00
parent 2bdaf773e2
commit 99855dfb37

View File

@ -1335,15 +1335,9 @@ describe('Frontend Controller', function () {
}); });
describe('private', function () { describe('private', function () {
var req, res, config, defaultPath; var req, config;
defaultPath = '/core/server/views/private.hbs';
beforeEach(function () { beforeEach(function () {
res = {
locals: {version: '', relativeUrl: '/private/'},
render: sandbox.spy()
},
req = { req = {
route: {path: '/private/?r=/'}, route: {path: '/private/?r=/'},
query: {r: ''}, query: {r: ''},
@ -1369,37 +1363,47 @@ describe('Frontend Controller', function () {
}); });
it('Should render default password page when theme has no password template', function (done) { it('Should render default password page when theme has no password template', function (done) {
var res = {
locals: {version: '', relativeUrl: '/private/'},
render: function (view) {
view.should.match(/private.hbs/);
done();
}
};
frontend.__set__('config', config); frontend.__set__('config', config);
frontend.private(req, res, done).then(function () { frontend.private(req, res, failTest(done));
res.render.calledWith(defaultPath).should.be.true;
res.locals.context.should.containEql('private');
done();
}).catch(done);
}); });
it('Should render theme password page when it exists', function (done) { it('Should render theme password page when it exists', function (done) {
var res = {
locals: {version: '', relativeUrl: '/private/'},
render: function (view) {
view.should.equal('private');
done();
}
};
config.paths.availableThemes.casper = { config.paths.availableThemes.casper = {
'private.hbs': '/content/themes/casper/private.hbs' 'private.hbs': '/content/themes/casper/private.hbs'
}; };
frontend.__set__('config', config); frontend.__set__('config', config);
frontend.private(req, res, done).then(function () { frontend.private(req, res, failTest(done));
res.render.calledWith('private').should.be.true;
res.locals.context.should.containEql('private');
done();
}).catch(done);
}); });
it('Should render with error when error is passed in', function (done) { it('Should render with error when error is passed in', function (done) {
var res = {
error: 'Test Error',
locals: {version: '', relativeUrl: '/private/'},
render: function (view, context) {
view.should.match(/private.hbs/);
context.error.should.equal('Test Error');
done();
}
};
frontend.__set__('config', config); frontend.__set__('config', config);
res.error = 'Test Error';
frontend.private(req, res, done).then(function () { frontend.private(req, res, failTest(done));
res.render.calledWith(defaultPath, {error: 'Test Error'}).should.be.true;
res.locals.context.should.containEql('private');
done();
}).catch(done);
}); });
}); });
}); });