Introduce API, use it in rule spec