{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/ember-intl/issues/76","labels_url":"https://api.github.com/repos/yahoo/ember-intl/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/ember-intl/issues/76/comments","events_url":"https://api.github.com/repos/yahoo/ember-intl/issues/76/events","html_url":"https://github.com/yahoo/ember-intl/issues/76","id":63436178,"number":76,"title":"Unable to lookup the \"intl:main\" service in unit tests","user":{"login":"mordack","id":393280,"avatar_url":"https://avatars.githubusercontent.com/u/393280?v=3","gravatar_id":"","url":"https://api.github.com/users/mordack","html_url":"https://github.com/mordack","followers_url":"https://api.github.com/users/mordack/followers","following_url":"https://api.github.com/users/mordack/following{/other_user}","gists_url":"https://api.github.com/users/mordack/gists{/gist_id}","starred_url":"https://api.github.com/users/mordack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mordack/subscriptions","organizations_url":"https://api.github.com/users/mordack/orgs","repos_url":"https://api.github.com/users/mordack/repos","events_url":"https://api.github.com/users/mordack/events{/privacy}","received_events_url":"https://api.github.com/users/mordack/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-21T18:05:51Z","updated_at":"2015-03-22T19:45:46Z","closed_at":null,"body":"At the moment I'm unable to write unit tests for components that use of the ```format-message``` and ```intl-get``` helpers in the component template.\r\n\r\nInitially, this is what I've tried when just setting the test up:\r\n```\r\nneeds: [\r\n  'locale:en-GB', 'helper:format-message', 'helper:intl-get'\r\n]\r\n```\r\nThis results in an exception when calling ```this.render()``` in the actual tests:\r\n```TypeError: Cannot read property 'on' of undefined```, the stacktrace points to [this](https://github.com/yahoo/ember-intl/blob/master/app/helpers/intl-get.js#L45) line. Which makes sense as ```'intl:main'``` is missing from the needs block.\r\n\r\nI tried adding ```'intl:main'``` to the needs block:\r\n```\r\nneeds: [\r\n  'intl:main', 'locale:en-GB',\r\n  'helper:format-message', 'helper:intl-get'\r\n]\r\n```\r\nWhich also resulted in an exception:\r\n```TypeError: Attempting to register an unknown factory: `intl:main````.\r\n\r\nAfter digging through the ember-intl source I noticed that the ember-intl initializer sets up the intl service as ```intl:main``` instead of ```service:intl```. Trying to inject ```service:intl``` in the needs block doesn't work either.\r\n\r\nMy best guess is that initializers don't run in a (module) unit test, resulting in ```intl:main``` never being registered on the container/app. Because the ```intl-get``` helper injects ```intl:main``` rather than ```service:intl```, adding ```service:intl``` to the test's need block won't do anything.\r\n\r\nAt the moment, I don't even care what format-message/intl-get renders, stubbing out whatever ```format-message``` and/or ```intl-get``` needs would work just fine for me as well, I just want to be able to render the component's template without exceptions. (I just don't know how to do this)\r\n\r\nMy actual question(s):\r\n* Am I doing something wrong?\r\n* Is there any documentation that I missed that explains how to do this/make it work?\r\n* If I'm not doing anything wrong, is there a way to work around this (eg. stubbing ```intl``` on ```intl-get```)?\r\n\r\nAny answers or pointers in the right direction would be greatly appreciated!"},"comment":{"url":"https://api.github.com/repos/yahoo/ember-intl/issues/comments/84685924","html_url":"https://github.com/yahoo/ember-intl/issues/76#issuecomment-84685924","issue_url":"https://api.github.com/repos/yahoo/ember-intl/issues/76","id":84685924,"user":{"login":"jasonmit","id":3108309,"avatar_url":"https://avatars.githubusercontent.com/u/3108309?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonmit","html_url":"https://github.com/jasonmit","followers_url":"https://api.github.com/users/jasonmit/followers","following_url":"https://api.github.com/users/jasonmit/following{/other_user}","gists_url":"https://api.github.com/users/jasonmit/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonmit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonmit/subscriptions","organizations_url":"https://api.github.com/users/jasonmit/orgs","repos_url":"https://api.github.com/users/jasonmit/repos","events_url":"https://api.github.com/users/jasonmit/events{/privacy}","received_events_url":"https://api.github.com/users/jasonmit/received_events","type":"User","site_admin":false},"created_at":"2015-03-22T19:45:46Z","updated_at":"2015-03-22T19:45:46Z","body":"> Using the #77 branch and the testing documentation, this is the exception that I get: \r\n> TypeError: Cannot read property 'IntlAdapter' of undefined, pointing to this line, telling me that app isn't properly injected into service:intl.\r\n\r\nThat's saying that app wasn't created from the `container.lookup` above it.  I haven't run into this, but my test didn't cover format-message so I'll switch my example to that since it's a more complicated test and probably the most common.\r\n\r\nDo you have a branch anywhere that I can debug against?  I'll try and dig into ember-mocha to see why they're not registering `application:main`.\r\n\r\nThanks :+1: "}}