refactored specs using macros and shared examples