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

IsolatedContainer doesn't normalize type names #84

Closed
jbourassa opened this issue Aug 13, 2014 · 2 comments
Closed

IsolatedContainer doesn't normalize type names #84

jbourassa opened this issue Aug 13, 2014 · 2 comments

Comments

@jbourassa
Copy link

The IsolatedContainer doesn't normalize type keys from oneThing to one-thing as the regular container would do.

This is an issue because ember-data accepts relationship using camelcased model names, so configuring a test with needs: ['model:one-thing'] and using oneThing: DS.belongsTo('oneThing') in a model definition will cause the resolver to crash when looking for oneThing (through store.modelFor).

Based on what ember / ember-cli does, this patch fixes the issue for me, but I do not understand the resolver well enough to be confident in that change.

diff --git a/lib/isolated-container.js b/lib/isolated-container.js
index 0293b9c..cae4ae9 100644
--- a/lib/isolated-container.js
+++ b/lib/isolated-container.js
@@ -4,6 +4,10 @@ import Ember from 'ember';
 export default function isolatedContainer(fullNames) {
   var resolver = testResolver.get();
   var container = new Ember.Container();
+  container.resolver = function(name) {
+    return resolver.resolve(name);
+  }
+  container.normalize = resolver.normalize;
   container.optionsForType('component', { singleton: false });
   container.optionsForType('view', { singleton: false });
   container.optionsForType('template', { instantiate: false });
@marcoow
Copy link

marcoow commented Sep 23, 2014

I think the same thing just bit me as well. When I specify

needs: ['serializer:embedd-switch-port-mapping']

any the code I test calls store.serializerFor('embedd-switch-port-mapping'), Ember Data ends up looking for 'serializer:embeddSwitchPortMapping' which it doesn't find.

@dgeb
Copy link
Member

dgeb commented Nov 1, 2014

Closed via emberjs/ember-test-helpers#2 - thanks @marcoow !

@dgeb dgeb closed this as completed Nov 1, 2014
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