Refactor relations tests to improve code re-use.