Factor out common code in specs