Introduce a common base for Rule and OneOf, add tests