Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
[FEATURE] board and compte should not be accessible while disconnected
Browse files Browse the repository at this point in the history
  • Loading branch information
Akhilian committed Aug 25, 2017
1 parent 6bc0d50 commit db8dafa
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
5 changes: 4 additions & 1 deletion live/app/routes/board.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default Ember.Route.extend({
export default Ember.Route.extend(AuthenticatedRouteMixin, {

authenticationRoute: '/connexion',

model() {
return this.get('store').queryRecord('user', {})
Expand Down
2 changes: 1 addition & 1 deletion live/app/routes/compte.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout

export default Ember.Route.extend(AuthenticatedRouteMixin, {

authenticationRoute: '/',
authenticationRoute: '/connexion',

model() {
const store = this.get('store');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Acceptance | Espace compte', function() {

// then
return andThen(function() {
expect(currentURL()).to.equal('/');
expect(currentURL()).to.equal('/connexion');
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion live/tests/acceptance/compte-display-competence-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Acceptance | Compte | competence profile', function() {
// when
await visit('/compte');
return andThen(() => {
expect(currentURL()).to.equal('/');
expect(currentURL()).to.equal('/connexion');
});
});

Expand Down
19 changes: 17 additions & 2 deletions live/tests/acceptance/o1-board-organization-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Acceptance | o1 - board organization', function() {
firstName: 'Benjamin',
lastName: 'Marteau',
email: 'benjamin.marteau@pix.com',
password: '1024pix!',
password: '1024pix!',
organizationIds: [1]
});
}
Expand All @@ -41,9 +41,24 @@ describe('Acceptance | o1 - board organization', function() {
await visit('/board');

// then
return andThen(() => {
andThen(() => {
expect(currentURL()).to.equal('/board');
});

await visit('/deconnexion');
});

it('should not be accessible while the user is not connected', async function() {
// given
seedDatabase();

// when
await visit('/board');

// then
andThen(() => {
expect(currentURL()).to.equal('/connexion');
});
});

it('should display the name and the code of my organization', async function() {
Expand Down
2 changes: 1 addition & 1 deletion live/tests/unit/routes/board-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import sinon from 'sinon';
describe('Unit | Route | board', function() {
setupTest('route:board', {
// Specify the other units that are required for this test.
needs: ['service:current-routed-modal']
needs: ['service:current-routed-modal', 'service:session']
});

it('exists', function() {
Expand Down
2 changes: 1 addition & 1 deletion live/tests/unit/routes/compte-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Unit | Route | compte', function() {
const route = this.subject();

// Then
expect(route.authenticationRoute).to.equal('/');
expect(route.authenticationRoute).to.equal('/connexion');
});

describe('searchForOrganization', function() {
Expand Down

0 comments on commit db8dafa

Please sign in to comment.