0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

fix 404 acceptance tests

This commit is contained in:
Austin Burdine 2016-02-05 06:16:29 -06:00
parent 8b5ea4691a
commit 3b2a97179c
2 changed files with 20 additions and 34 deletions

View file

@ -282,26 +282,19 @@ describe('Acceptance: Settings - Tags', function () {
});
});
describe('with 404', function () {
beforeEach(function () {
errorOverride();
it('redirects to 404 when tag does not exist', function () {
server.get('/tags/slug/unknown/', function () {
return new Mirage.Response(404, {'Content-Type': 'application/json'}, {errors: [{message: 'Tag not found.', errorType: 'NotFoundError'}]});
});
afterEach(function () {
errorOverride();
visit('settings/tags/unknown');
andThen(() => {
errorReset();
});
it('redirects to 404 when tag does not exist', function () {
server.get('/tags/slug/unknown/', function () {
return new Mirage.Response(404, {'Content-Type': 'application/json'}, {errors: [{message: 'Tag not found.', errorType: 'NotFoundError'}]});
});
visit('settings/tags/unknown');
andThen(() => {
expect(currentPath()).to.equal('error404');
expect(currentURL()).to.equal('/settings/tags/unknown');
});
expect(currentPath()).to.equal('error404');
expect(currentURL()).to.equal('/settings/tags/unknown');
});
});
});

View file

@ -321,26 +321,19 @@ describe('Acceptance: Team', function () {
});
});
describe('with 404', function () {
beforeEach(function () {
errorOverride();
it('redirects to 404 when tag does not exist', function () {
server.get('/users/slug/unknown/', function () {
return new Mirage.Response(404, {'Content-Type': 'application/json'}, {errors: [{message: 'User not found.', errorType: 'NotFoundError'}]});
});
afterEach(function () {
errorOverride();
visit('/team/unknown');
andThen(() => {
errorReset();
});
it('redirects to 404 when tag does not exist', function () {
server.get('/users/slug/unknown/', function () {
return new Mirage.Response(404, {'Content-Type': 'application/json'}, {errors: [{message: 'User not found.', errorType: 'NotFoundError'}]});
});
visit('/team/unknown');
andThen(() => {
expect(currentPath()).to.equal('error404');
expect(currentURL()).to.equal('/team/unknown');
});
expect(currentPath()).to.equal('error404');
expect(currentURL()).to.equal('/team/unknown');
});
});
});