0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fix tests

This commit is contained in:
Peter Zimon 2022-02-02 10:57:34 +01:00
parent b5995419dc
commit d5018cbb3a
9 changed files with 20 additions and 9 deletions

View file

@ -8,6 +8,7 @@ export default class SettingsDesignRoute extends AdminRoute {
@service settings; @service settings;
@service themeManagement; @service themeManagement;
@service ui; @service ui;
@service session;
model() { model() {
// background refresh of preview // background refresh of preview
@ -22,6 +23,16 @@ export default class SettingsDesignRoute extends AdminRoute {
]); ]);
} }
beforeModel() {
super.beforeModel(...arguments);
const user = this.session.user;
if (!user.isAdmin) {
return this.transitionTo('settings.staff.user', user);
}
}
activate() { activate() {
this.ui.contextualNavMenu = 'design'; this.ui.contextualNavMenu = 'design';
} }

View file

@ -29,7 +29,7 @@ describe('Acceptance: Settings - Integrations - AMP', function () {
await authenticateSession(); await authenticateSession();
await visit('/settings/integrations/amp'); await visit('/settings/integrations/amp');
expect(currentURL(), 'currentURL').to.equal('/site'); expect(currentURL(), 'currentURL').to.equal('/posts');
}); });
it('redirects to home page when authenticated as author', async function () { it('redirects to home page when authenticated as author', async function () {

View file

@ -29,7 +29,7 @@ describe('Acceptance: Settings - Code-Injection', function () {
await authenticateSession(); await authenticateSession();
await visit('/settings/code-injection'); await visit('/settings/code-injection');
expect(currentURL(), 'currentURL').to.equal('/site'); expect(currentURL(), 'currentURL').to.equal('/posts');
}); });
it('redirects to staff page when authenticated as author', async function () { it('redirects to staff page when authenticated as author', async function () {

View file

@ -25,7 +25,7 @@ describe('Acceptance: Settings - General', function () {
await authenticateSession(); await authenticateSession();
await visit('/settings/general'); await visit('/settings/general');
expect(currentURL(), 'currentURL').to.equal('/site'); expect(currentURL(), 'currentURL').to.equal('/posts');
}); });
it('redirects to home page when authenticated as author', async function () { it('redirects to home page when authenticated as author', async function () {

View file

@ -29,7 +29,7 @@ describe('Acceptance: Settings - Integrations - Custom', function () {
await authenticateSession(); await authenticateSession();
await visit('/settings/integrations'); await visit('/settings/integrations');
expect(currentURL(), 'currentURL').to.equal('/site'); expect(currentURL(), 'currentURL').to.equal('/posts');
}); });
it('redirects /integrations/ to home page when authenticated as author', async function () { it('redirects /integrations/ to home page when authenticated as author', async function () {
@ -66,7 +66,7 @@ describe('Acceptance: Settings - Integrations - Custom', function () {
await authenticateSession(); await authenticateSession();
await visit('/settings/integrations/1'); await visit('/settings/integrations/1');
expect(currentURL(), 'currentURL').to.equal('/site'); expect(currentURL(), 'currentURL').to.equal('/posts');
}); });
it('redirects /integrations/:id/ to home page when authenticated as author', async function () { it('redirects /integrations/:id/ to home page when authenticated as author', async function () {

View file

@ -27,7 +27,7 @@ describe('Acceptance: Settings - Labs', function () {
await authenticateSession(); await authenticateSession();
await visit('/settings/labs'); await visit('/settings/labs');
expect(currentURL(), 'currentURL').to.equal('/site'); expect(currentURL(), 'currentURL').to.equal('/posts');
}); });
it('redirects to home page when authenticated as author', async function () { it('redirects to home page when authenticated as author', async function () {

View file

@ -26,7 +26,7 @@ describe('Acceptance: Settings - Integrations - Slack', function () {
await authenticateSession(); await authenticateSession();
await visit('/settings/integrations/slack'); await visit('/settings/integrations/slack');
expect(currentURL(), 'currentURL').to.equal('/site'); expect(currentURL(), 'currentURL').to.equal('/posts');
}); });
it('redirects to home page when authenticated as author', async function () { it('redirects to home page when authenticated as author', async function () {

View file

@ -29,7 +29,7 @@ describe('Acceptance: Settings - Integrations - Unsplash', function () {
await authenticateSession(); await authenticateSession();
await visit('/settings/integrations/unsplash'); await visit('/settings/integrations/unsplash');
expect(currentURL(), 'currentURL').to.equal('/site'); expect(currentURL(), 'currentURL').to.equal('/posts');
}); });
it('redirects to home page when authenticated as author', async function () { it('redirects to home page when authenticated as author', async function () {

View file

@ -28,7 +28,7 @@ describe('Acceptance: Settings - Integrations - Zapier', function () {
await authenticateSession(); await authenticateSession();
await visit('/settings/integrations/zapier'); await visit('/settings/integrations/zapier');
expect(currentURL(), 'currentURL').to.equal('/site'); expect(currentURL(), 'currentURL').to.equal('/posts');
}); });
it('redirects to home page when authenticated as author', async function () { it('redirects to home page when authenticated as author', async function () {