add setter for engine to allow mock in spec
replace predicate with a generic ruby method