Improve unit test to use a spec for mocks.