Skip to content

Commit

Permalink
Guard for missing Ember.inject.
Browse files Browse the repository at this point in the history
This is not present on Ember < 1.10.
  • Loading branch information
rwjblue committed Oct 2, 2015
1 parent 1406879 commit 3ba6a55
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/ember-test-helpers/test-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,15 @@ export default Klass.extend({

var context = this.context = getContext();

Object.keys(Ember.inject).forEach(function(typeName) {
context.inject[typeName] = function(name, opts) {
var alias = (opts && opts.as) || name;
Ember.set(context, alias, context.container.lookup(typeName + ':' + name));
};
});
if (Ember.inject) {
var keys = (Object.keys || Ember.keys)(Ember.inject);
keys.forEach(function(typeName) {
context.inject[typeName] = function(name, opts) {
var alias = (opts && opts.as) || name;
Ember.set(context, alias, context.container.lookup(typeName + ':' + name));
};
});
}
},

setupTestElements: function() {
Expand Down

0 comments on commit 3ba6a55

Please sign in to comment.