Refactor rules tests