So it does raise the error when setting only_if, this test is actually correct, albeit we're not using 'expect' as btm pointed out.
The only_if method ultimately calls into GuardInterpreter.new, which tries to resolve the guard_interpreter symbol as a resource. An invalid resource will generate the exception. This happens before run_action ever gets called.