Skip to content

Commit 5924b6f

Browse files
committed
fix: ensure stubService returns reference to the service
1 parent f6f3721 commit 5924b6f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

addon-test-support/stub-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function stubService() {
3535
let [name] = arguments;
3636
let { owner } = getContext();
3737

38-
replace(owner, name);
38+
return replace(owner, name);
3939
} else {
4040
throw new Error("Unexpected number of arguments");
4141
}

tests/unit/test-support/stub-service-test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,19 @@ module("Test Helpers | stub-service", function(hooks) {
1818

1919
module("invoking without `hooks`", function(hooks) {
2020
hooks.beforeEach(function() {
21-
stubService("to-stub");
21+
this.service = stubService("to-stub");
2222
});
2323

2424
test("it can replace a service", function(assert) {
2525
let service = this.owner.lookup("service:to-stub");
2626
service.method();
2727

2828
assert.verify(service.method());
29+
assert.equal(
30+
service,
31+
this.service,
32+
"Returns a references to the stubbed service"
33+
);
2934
});
3035
});
3136
});

0 commit comments

Comments
 (0)