Skip to content

Commit

Permalink
Removes Integration Property from callbacks, Adds tests for Needs and…
Browse files Browse the repository at this point in the history
… without Needs/Integration
  • Loading branch information
nikz committed Mar 12, 2015
1 parent 5983dfd commit 312101d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/ember-test-helpers/test-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default Klass.extend({

if (this.callbacks.integration) {
this.isIntegration = callbacks.integration;
delete callbacks.integration;
}

this.initSubject();
Expand Down
25 changes: 24 additions & 1 deletion tests/test-module-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down

0 comments on commit 312101d

Please sign in to comment.