refactored tests by adding spec helper methods