diff --git a/lib/ember-test-helpers/test-module.js b/lib/ember-test-helpers/test-module.js index 652d24899..ac87f679c 100644 --- a/lib/ember-test-helpers/test-module.js +++ b/lib/ember-test-helpers/test-module.js @@ -20,6 +20,7 @@ export default Klass.extend({ if (this.callbacks.integration) { this.isIntegration = callbacks.integration; + delete callbacks.integration; } this.initSubject(); diff --git a/tests/test-module-test.js b/tests/test-module-test.js index dd4ada923..2155f5b5c 100644 --- a/tests/test-module-test.js +++ b/tests/test-module-test.js @@ -125,8 +125,31 @@ test("subject's created in a test are destroyed", function() { expect(0); }); -moduleFor('component:x-foo', 'component:x-foo -- `integration: true`', { +moduleFor('component:x-foo', 'component:x-foo -- without needs or `integration: true`', { + beforeSetup: setupRegistry() +}); + +test("knows nothing about our non-subject component", function() { + var otherComponent = this.container.lookup('component:not-the-subject'); + equal(null, otherComponent, "We shouldn't know about a non-subject component") +}); + +moduleFor('component:x-foo', 'component:x-foo -- when needing another component', { beforeSetup: setupRegistry(), + needs: ['component:not-the-subject'] +}); + +test("needs gets us the component we need", function() { + var otherComponent = this.container.lookup('component:not-the-subject'); + ok(otherComponent, "another component can be resolved when it's in our needs array"); +}); + +moduleFor('component:x-foo', 'component:x-foo -- `integration: true`', { + beforeSetup: function() { + setupRegistry() + ok(!this.callbacks.integration, "integration property should be removed from callbacks"); + ok(this.isIntegration, "isIntegration should be set when we set `integration: true` in callbacks"); + }, integration: true });