Refactoring database tests to use shared examples