refactors specs to remove repetition