Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can no longer override registry in acceptance tests #124

Closed
mitchlloyd opened this issue Nov 23, 2015 · 8 comments
Closed

Can no longer override registry in acceptance tests #124

mitchlloyd opened this issue Nov 23, 2015 · 8 comments

Comments

@mitchlloyd
Copy link

At one point we could override services in acceptance tests. Now it seems like that behavior is no longer supported:

Is there another solution that currently works?

I'm using Ember 2.2.0 and ember-qunit 0.4.16.

@rwjblue
Copy link
Member

rwjblue commented Nov 23, 2015

@mitchlloyd - I'm not sure I follow. The PR referenced (#96) made it possible to override services in unit or integration tests (not acceptance tests). In general acceptance tests do not use this repo (or ember-qunit) at all. The functionality in these tests are currently passing in Ember 1.11 and higher.

Can you provide me with an example of what you mean?

@mitchlloyd
Copy link
Author

If acceptance tests don't use this library then I must be mistaken that this worked in the past. I'm probably just confusing this behavior with component integration tests. Closing this issue.

I would like to do something like what was shown in your "Allow overriding services/factories in the registry" PR in an acceptance test. Something like:

this.application.register('service:analytics', MockAnalyticsService)

But I'm having trouble because of the tricky registry behavior that you documented in the commit message of that same PR. My workaround for now is to handle this stubbing in my production code, but if you can drop any registry knowledge bombs on me please do!

@rwjblue
Copy link
Member

rwjblue commented Nov 24, 2015

@mitchlloyd - The super crappy (but functional) workaround for this in acceptance tests is:

this.application.__deprecatedInstance__.register('service:foo', Ember.Service.extend());

I am actively working on a better solution to bring acceptance tests back into feature parity with integration tests (seems like a constant battle back and forth 😸).

@mitchlloyd
Copy link
Author

Thanks for that workaround. I appreciate all your hard work that makes my development experience better 👍

@kylecoberly
Copy link

This workaround saved my bacon just now, thank you!

@ghost
Copy link

ghost commented Sep 2, 2017

Any news on this? Why in acceptance test I can't use simply:

this.application.register("service:notifications", notificationsServiceMock)

instead of:

this.application.__deprecatedInstance__.register("service:notifications", notificationsServiceMock)?

Which is the correct way of doing this?

@rwjblue
Copy link
Member

rwjblue commented Sep 2, 2017

My comment in #124 (comment) is still correct.

@ghost
Copy link

ghost commented Sep 2, 2017

Ok, I'm using this right now, but how to know if things in future changes? New issue in this repo to subscribe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants