refactor specs with shared examples and macros