Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename _router property to _authRouter to avoid conflicts #1900

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addon/mixins/authenticated-route-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default Mixin.create({
*/
session: service('session'),

_router: computed(function() {
_authRouter: computed(function() {
let owner = getOwner(this);
return owner.lookup('service:router') || owner.lookup('router:main');
}),
Expand Down Expand Up @@ -128,6 +128,6 @@ export default Mixin.create({
let authenticationRoute = this.get('authenticationRoute');
assert('The route configured as Configuration.authenticationRoute cannot implement the AuthenticatedRouteMixin mixin as that leads to an infinite transitioning loop!', this.get('routeName') !== authenticationRoute);

this.get('_router').transitionTo(authenticationRoute);
this.get('_authRouter').transitionTo(authenticationRoute);
},
});
6 changes: 3 additions & 3 deletions tests/unit/mixins/authenticated-route-mixin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('AuthenticatedRouteMixin', () => {

route = createWithContainer(Route.extend(MixinImplementingBeforeModel, AuthenticatedRouteMixin, {}), {
session,
_router: router
_authRouter: router
}, containerMock);

sinon.spy(transition, 'send');
Expand All @@ -82,7 +82,7 @@ describe('AuthenticatedRouteMixin', () => {
it('does not transition to the authentication route', function() {
route.beforeModel(transition);

expect(route._router.transitionTo).to.not.have.been.calledWith(Configuration.authenticationRoute);
expect(route._authRouter.transitionTo).to.not.have.been.calledWith(Configuration.authenticationRoute);
});
});

Expand All @@ -96,7 +96,7 @@ describe('AuthenticatedRouteMixin', () => {
route.set('authenticationRoute', authenticationRoute);

route.beforeModel(transition);
expect(route._router.transitionTo).to.have.been.calledWith(authenticationRoute);
expect(route._authRouter.transitionTo).to.have.been.calledWith(authenticationRoute);
});

it('sets the redirectTarget cookie in fastboot', function() {
Expand Down