Rails: How to test state_machine?
- by petRUShka
Please, help me. I'm confused. I know how to write state-driven behavior of model, but I don't know what should I write in specs...
My model.rb file look
class Ratification < ActiveRecord::Base
belongs_to :user
attr_protected :status_events
state_machine :status, :initial => :boss do
state :boss
state :owner
state :declarant
state :done
event :approve do
transition :boss => :owner, :owner => :done
end
event :divert do
transition [:boss, :owner] => :declarant
end
event :repeat do
transition :declarant => :boss
end
end
end
I use state_machine gem.
Please, show me the course.