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

Allow reuse of Application.buildContainer without full Application. #4157

Closed

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Jan 16, 2014

This will allow usage of Ember.Application.buildContainer without needing providing a namespace (or an Ember.Application instance).

The primary impetus of this is to prevent from having to create one-off container look-alikes for unit testing. This also allows us to consolidate the knowledge of what things are registered and setup by default to a single
place.

This will be directly usable from within EAK (see isolatedContainer) for example.

This will allow usage of `Ember.Application.buildContainer` without
needing providing a namespace (or an Ember.Application instance).

The primary impetus of this is to prevent from having to create one-off
container look-alikes for unit testing. This also allows us to
consolidate the knowledge of what things are registered and setup by
default to a single place.
container.set = Ember.set;
container.resolver = resolverFor(namespace);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine wanting to use a resolver for unit tests

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you would simply have to provide a namespace.

@stefanpenner
Copy link
Member

I acknowledge a problem exists here, I am unsure if this is the solution though. I need to think on this some more.

@rwjblue
Copy link
Member Author

rwjblue commented Jan 31, 2014

No worries, I'd be happy to work out a better solution. Let me know if you have any suggestions/ideas to make the situation better.

@stefanpenner
Copy link
Member

ya, i'll try to grind out some ideas.

@rwjblue
Copy link
Member Author

rwjblue commented Feb 2, 2014

I definitely, think that we need an easily discoverable way to know the options for given types. Here are a couple more ideas:

  • Create initializers for the types with special/custom options?
  • Create a function for each special type that we can invoke from Ember.Application.buildContainer that can also be used in test code (perhaps Ember.Component.setupContainer that accepts the container instance and sets it up)?

@rwjblue rwjblue closed this Mar 9, 2014
@rwjblue rwjblue deleted the enable_reusing_buildContainer branch March 9, 2014 02:30
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

Successfully merging this pull request may close these issues.

None yet

3 participants