Refactor specs and fix bug in `Rule.passes` function