Fix method scope in test files