Merge pull request #2735 from shindakun/tag404

Display 404 page if tag does not exist.
This commit is contained in:
Hannah Wolfe 2014-05-14 16:32:18 +01:00
commit 692573a241
2 changed files with 12 additions and 1 deletions

View File

@ -133,6 +133,10 @@ frontendControllers = {
tag: page.meta.filters.tags ? page.meta.filters.tags[0] : ''
});
// If the resulting tag is '' then 404.
if (!result.tag) {
return next();
}
res.render(view, result);
});
});

View File

@ -14,4 +14,11 @@ CasperTest.begin('Check frontend route not found (404)', 2, function suite(test)
test.assertEqual(response.status, 404, 'Response status should be 404.');
test.assertSelectorHasText('.error-code', '404');
});
}, true);
}, true);
CasperTest.begin('Check frontend tag route not found (404)', 2, function suite(test) {
casper.thenOpen(url + 'tag/asdf/', function (response) {
test.assertEqual(response.status, 404, 'Response status should be 404.');
test.assertSelectorHasText('.error-code', '404');
});
}, true);