Skip to content
This repository has been archived by the owner on Aug 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #23 from rwjblue/fix-beta
Browse files Browse the repository at this point in the history
Fix tests to work on Ember 2.15+.
  • Loading branch information
rwjblue committed Jul 28, 2017
2 parents 4a74ef9 + 67f5f27 commit cdbe3e6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 28 deletions.
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -57,7 +57,10 @@ the list of supported Ember versions at the time of authoring was:
* 2.3
* 2.4
* 2.8
* 2.12 (canary at the time)
* 2.12
* 2.14
* 2.15
* 2.16 (canary at the time)

## Addon Maintenance

Expand Down
8 changes: 8 additions & 0 deletions config/ember-try.js
Expand Up @@ -82,6 +82,14 @@ module.exports = {
}
}
},
{
name: 'ember-2.12',
bower: {
dependencies: {
"ember": "~2.12.0"
}
}
},
{
name: 'ember-release',
bower: {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -33,10 +33,11 @@
"ember-ajax": "^2.0.1",
"ember-cli": "^2.7.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-babel": "^6.6.0",
"ember-cli-content-security-policy": "0.5.0",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-htmlbars": "^1.0.3",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-htmlbars-inline-precompile": "^0.4.2",
"ember-cli-inject-live-reload": "^1.4.0",
"ember-cli-jshint": "^1.0.0",
"ember-cli-qunit": "^3.1.0",
Expand Down
55 changes: 29 additions & 26 deletions tests/unit/getowner-test.js
Expand Up @@ -42,32 +42,35 @@ test('it can use getOwner to register things', function(assert) {
assert.ok(result.isBaz, 'was able to register and lookup');
});

test('it can use getOwner for the private _lookupFactory', function(assert) {
let testFn = () => {
let subject = this.subject();
let owner = getOwner(subject);

let Baz = Ember.Object.extend();
Baz.reopenClass({ isBazFactory: true });

owner.register('foo:baz', Baz);

let result = owner._lookupFactory('foo:baz');

assert.ok(result.isBazFactory, 'was able to register and _lookupFactory');
};

// we only can assert that a deprecation occurs when we are using
// our custom `getOwner` polyfill. For Ember 2.3 - 2.11 we simply confirm
// the functionality (not the deprecation).
if (!hasEmberVersion(2,3) || hasEmberVersion(2,12)) {
assert.deprecations(testFn, [
'Using "_lookupFactory" is deprecated. Please use container.factoryFor instead.'
]);
} else {
testFn();
}
});
// In Ember 2.15 `_lookupFactory` was removed (in favor of `factoryFor`
if (!hasEmberVersion(2,15)) {
test('it can use getOwner for the private _lookupFactory', function(assert) {
let testFn = () => {
let subject = this.subject();
let owner = getOwner(subject);

let Baz = Ember.Object.extend();
Baz.reopenClass({ isBazFactory: true });

owner.register('foo:baz', Baz);

let result = owner._lookupFactory('foo:baz');

assert.ok(result.isBazFactory, 'was able to register and _lookupFactory');
};

// we only can assert that a deprecation occurs when we are using
// our custom `getOwner` polyfill. For Ember 2.3 - 2.11 we simply confirm
// the functionality (not the deprecation).
if (!hasEmberVersion(2,3) || hasEmberVersion(2,12)) {
assert.deprecations(testFn, [
'Using "_lookupFactory" is deprecated. Please use container.factoryFor instead.'
]);
} else {
testFn();
}
});
}

test('it can use getOwner for factoryFor', function(assert) {
let subject = this.subject();
Expand Down

0 comments on commit cdbe3e6

Please sign in to comment.