Hi Charly,
Thanks for taking the time to post.
From what I can see, it appears the issue is that you expected the
method #completed? to be defined, and to evaluate to true when the
current_state_name is :completed.
This *is* the case in the experimental branch of StateFu (not yet
available for public consumption, but should be in the next few days);
however currently query methods are not defined for states, only
events; as #completed? does not exist, :if => :completed? is
evaluating to false and your validation is never taking effect (as far
as i can tell). Try adding the following method:
def completed?
state_fu.current_state == :completed
end
And let me know if this helps.
In the next release of StateFu, #completed? will be defined for you
and this should work out of the box.
best regards,
David Lee