refactor hooks_spec