Refactored specs using sinon