Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

How do I inject a controller into a mixin for testing?

$
0
0

@eibrahim wrote:

I have a mixin that has the following injection:

application: Ember.inject.controller(),

My unit test fails:

  var WorkflowCommonObject = Ember.Object.extend(WorkflowCommonMixin);
  var subject = WorkflowCommonObject.create(this.container);
  assert.ok(subject);;
});

with the following error:

Assertion Failed: Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.

How do I inject the controller into the mixin or how do i create the object via a container so my test would pass?

I have similar other scenarios where I need to inject services into the mixin but can't figure out a way to stub the services. I tried the registring in the setup function but that doesn't work in mixins - it worked everywhere else though.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles