Asserting that a mixin is present


#1

Hi

I can’t seem to find a way to do this (maybe it’s not supposed to be done :P).

I’m using ember-simple-auth for authentication, and I would like to have my route tests asserting that the AuthenticatedRouteMixin is present (instead of having to create one more acceptance test where I check that when you visit the route you’re redirected to the login route).

How can I achieve this? Should I want to achieve this?

Thanks for any help


#2

You can use http://emberjs.com/api/classes/Ember.Mixin.html#method_detect to do exactly that.

let r = Em.Route.extend(AuthenticatedRouteMixin).create();
AuthenticatedRouteMixin.detect(r); // true

#3

Hey @maxn, thanks for replying. It seems though that the detect method is private :frowning:

I really would like to avoid using private methods, any other idea/workaround?

Thanks again for taking the time to reply!