2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

add author edit route

no issue
- adds front-end author edit route that redirects to the edit author page
- adds tests for edit route
This commit is contained in:
Austin Burdine 2015-09-23 08:33:09 -05:00
parent b160cd2e32
commit 61705cf5f4
2 changed files with 29 additions and 0 deletions

View file

@ -66,6 +66,9 @@ frontendRoutes = function frontendRoutes(middleware) {
// Authors
authorRouter.route('/').get(frontend.author);
authorRouter.route('/edit?').get(function redirect(req, res) {
res.redirect(subdir + '/ghost/team/' + req.params.slug + '/');
});
authorRouter.route('/' + routeKeywords.page + '/:page/').get(frontend.author);
authorRouter.use(rssRouter);

View file

@ -575,6 +575,32 @@ describe('Frontend Routing', function () {
.end(doEnd(done));
});
});
describe('Author edit', function () {
it('should redirect without slash', function (done) {
request.get('/author/ghost-owner/edit')
.expect('Location', '/author/ghost-owner/edit/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('should redirect to editor', function (done) {
request.get('/author/ghost-owner/edit/')
.expect('Location', '/ghost/team/ghost-owner/')
.expect('Cache-Control', testUtils.cacheRules['public'])
.expect(302)
.end(doEnd(done));
});
it('should 404 for something that isn\'t edit', function (done) {
request.get('/author/ghost-owner/notedit/')
.expect('Cache-Control', testUtils.cacheRules['private'])
.expect(404)
.expect(/Page not found/)
.end(doEnd(done));
});
});
});
describe('Tag pages', function () {