Refactored specs to use newer stub and mock syntax. [ci skip]