gist_spec: remove some repetitive code