Skip to content

Commit 3562676

Browse files
bpamiriclaude
andcommitted
Fix inject() test isolation: reset cached controller services between specs
controller("dummy") returns a cached class whose $class.services array persists across test specs. Without cleanup, each inject() test inherits accumulated service names from prior tests, causing 3 of 4 specs to fail. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent cb0d4a7 commit 3562676

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

vendor/wheels/tests/specs/di/InjectorSpec.cfc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ component extends="wheels.WheelsTest" {
211211

212212
describe("inject() controller helper", () => {
213213

214+
beforeEach(() => {
215+
// Reset the cached controller's services array to prevent cross-test contamination.
216+
// controller("dummy") returns a cached class whose $class.services persists between specs.
217+
var ctrl = application.wo.controller("dummy");
218+
ctrl.$getControllerClassData().services = [];
219+
});
220+
214221
it("stores service names in class data", () => {
215222
// Test through a real controller instance (inject/injectedServices are Controller mixins)
216223
var ctrl = application.wo.controller("dummy");

0 commit comments

Comments
 (0)