Skip to content

Commit

Permalink
tests: Remove setOwner() calls
Browse files Browse the repository at this point in the history
setOwner() is not polyfilled by ember-getowner-polyfill and fails on older Ember versions
  • Loading branch information
Turbo87 committed Jan 4, 2017
1 parent 27df653 commit 40236b8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
5 changes: 2 additions & 3 deletions tests/unit/internal-session-test.js
Expand Up @@ -7,7 +7,7 @@ import InternalSession from 'ember-simple-auth/internal-session';
import EphemeralStore from 'ember-simple-auth/session-stores/ephemeral';
import Authenticator from 'ember-simple-auth/authenticators/base';

const { RSVP, K, run: { next }, setOwner } = Ember;
const { RSVP, K, run: { next } } = Ember;

describe('InternalSession', () => {
let session;
Expand All @@ -19,8 +19,7 @@ describe('InternalSession', () => {
container = { lookup() {} };
store = EphemeralStore.create();
authenticator = Authenticator.create();
session = InternalSession.create({ store });
setOwner(session, container);
session = InternalSession.create({ store, container });
sinon.stub(container, 'lookup').withArgs('authenticator').returns(authenticator);
});

Expand Down
7 changes: 3 additions & 4 deletions tests/unit/mixins/application-route-mixin-test.js
Expand Up @@ -7,7 +7,7 @@ import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mi
import InternalSession from 'ember-simple-auth/internal-session';
import EphemeralStore from 'ember-simple-auth/session-stores/ephemeral';

const { Route, run: { next }, setOwner } = Ember;
const { Route, run: { next } } = Ember;

describe('ApplicationRouteMixin', () => {
let session;
Expand All @@ -30,10 +30,9 @@ describe('ApplicationRouteMixin', () => {
route = Route.extend(ApplicationRouteMixin, {
transitionTo() {}
}).create({
session
session,
container: containerMock
});

setOwner(route, containerMock);
});

describe('mapping of service events to route methods', () => {
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/mixins/authenticated-route-mixin-test.js
Expand Up @@ -8,7 +8,7 @@ import InternalSession from 'ember-simple-auth/internal-session';
import Configuration from 'ember-simple-auth/configuration';
import EphemeralStore from 'ember-simple-auth/session-stores/ephemeral';

const { Mixin, RSVP, Route, setOwner } = Ember;
const { Mixin, RSVP, Route } = Ember;

describe('AuthenticatedRouteMixin', () => {
let route;
Expand Down Expand Up @@ -51,9 +51,7 @@ describe('AuthenticatedRouteMixin', () => {
_isFastBoot: false,
// replace actual transitionTo as the router isn't set up etc.
transitionTo() {}
}).create({ session });

setOwner(route, containerMock);
}).create({ session, container: containerMock });

sinon.spy(transition, 'send');
sinon.spy(route, 'transitionTo');
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/services/session-test.js
Expand Up @@ -5,7 +5,7 @@ import { expect } from 'chai';
import sinon from 'sinon';
import Session from 'ember-simple-auth/services/session';

const { ObjectProxy, Evented, run: { next }, set, setOwner } = Ember;
const { ObjectProxy, Evented, run: { next }, set } = Ember;

describe('SessionService', () => {
let sessionService;
Expand All @@ -23,8 +23,7 @@ describe('SessionService', () => {
let stub = sinon.stub(container, 'lookup');
stub.withArgs('authorizer').returns(authorizer);
stub.withArgs('bad-authorizer').returns(undefined);
sessionService = Session.create({ session });
setOwner(sessionService, container);
sessionService = Session.create({ session, container });
});

it('forwards the "authenticationSucceeded" event from the session', (done) => {
Expand Down

0 comments on commit 40236b8

Please sign in to comment.