Refactored the redundancy in my tests