Personally, I'd have used a real gdbm DB here. Looking at the code above, they seem easy enough to create and accessing them must be cheap if we're using it in the implementation. I tend to leave mocks as a last resort for cases where it's really painful to use the live version. Otherwise, I like the idea of the tests being as close as possible to the actual production usage of them and as few fake pieces as possible.