Fix deprecated rspec calls

`mock` and `stub` have been deprecated.

These changes makes the tests run with no deprecation warnings.