replace deprecated stub syntax with rspec allow syntax.

Small pull request to replace calls to `object.stub` with `allow(object)` to remove deprecation warnings when running the test suite.