{"action":"created","issue":{"url":"https://api.github.com/repos/switchfly/ember-test-helpers/issues/96","labels_url":"https://api.github.com/repos/switchfly/ember-test-helpers/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/switchfly/ember-test-helpers/issues/96/comments","events_url":"https://api.github.com/repos/switchfly/ember-test-helpers/issues/96/events","html_url":"https://github.com/switchfly/ember-test-helpers/pull/96","id":101987099,"number":96,"title":"Allow overriding services/factories in the registry.","user":{"login":"rwjblue","id":12637,"avatar_url":"https://avatars.githubusercontent.com/u/12637?v=3","gravatar_id":"","url":"https://api.github.com/users/rwjblue","html_url":"https://github.com/rwjblue","followers_url":"https://api.github.com/users/rwjblue/followers","following_url":"https://api.github.com/users/rwjblue/following{/other_user}","gists_url":"https://api.github.com/users/rwjblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rwjblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwjblue/subscriptions","organizations_url":"https://api.github.com/users/rwjblue/orgs","repos_url":"https://api.github.com/users/rwjblue/repos","events_url":"https://api.github.com/users/rwjblue/events{/privacy}","received_events_url":"https://api.github.com/users/rwjblue/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-08-19T20:09:02Z","updated_at":"2015-08-23T16:00:44Z","closed_at":"2015-08-19T21:35:41Z","pull_request":{"url":"https://api.github.com/repos/switchfly/ember-test-helpers/pulls/96","html_url":"https://github.com/switchfly/ember-test-helpers/pull/96","diff_url":"https://github.com/switchfly/ember-test-helpers/pull/96.diff","patch_url":"https://github.com/switchfly/ember-test-helpers/pull/96.patch"},"body":"By default in Ember things that are automatically resolved take precedence over things that are manually registered. This is somewhat counterintuitive to many people, as they would like to be able to override a service or other factory in a given set of tests (for example to use a mock analytics service).\n\nThe ability to do this has existed since the SSR/Fastboot work that split the registry from the container in 1.11, but I only recently realized how I could leverage that work here.\n\nThis change adds new functionality on Ember 1.11+, but allows older versions to continue to work as they do today (aka non-breaking).\n\n---\n\nExample:\n\nAssuming you have a `app/services/analytics.js` and want to use a mock service for a set of component integration tests, you might do something like this:\n\n```javascript\nimport MockAnalyticsService from '../mock-services/analytics';\nimport { moduleForComponent, test } from 'ember-qunit';\n\nmoduleForComponent('something-cool', {\n  integration: true,\n  beforeEach() {\n    this.registry.register('service:analytics', MockAnalyticsService);\n  }\n});\n```\n\nIn the above scenario, the mock service would be used instead of the one at `app/services/analytics.js`."},"comment":{"url":"https://api.github.com/repos/switchfly/ember-test-helpers/issues/comments/133869417","html_url":"https://github.com/switchfly/ember-test-helpers/pull/96#issuecomment-133869417","issue_url":"https://api.github.com/repos/switchfly/ember-test-helpers/issues/96","id":133869417,"user":{"login":"tim-evans","id":177701,"avatar_url":"https://avatars.githubusercontent.com/u/177701?v=3","gravatar_id":"","url":"https://api.github.com/users/tim-evans","html_url":"https://github.com/tim-evans","followers_url":"https://api.github.com/users/tim-evans/followers","following_url":"https://api.github.com/users/tim-evans/following{/other_user}","gists_url":"https://api.github.com/users/tim-evans/gists{/gist_id}","starred_url":"https://api.github.com/users/tim-evans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tim-evans/subscriptions","organizations_url":"https://api.github.com/users/tim-evans/orgs","repos_url":"https://api.github.com/users/tim-evans/repos","events_url":"https://api.github.com/users/tim-evans/events{/privacy}","received_events_url":"https://api.github.com/users/tim-evans/received_events","type":"User","site_admin":false},"created_at":"2015-08-23T16:00:44Z","updated_at":"2015-08-23T16:00:44Z","body":"Mocking out functions that are the only export from a file."}}