Fix #232: move ctx creation to protected function, override than in test