Sha256: 7bc46791170f6da4786038291cfb9de3715904130077f74e21ca5fdf03f09ecf
Contents?: true
Size: 1012 Bytes
Versions: 10
Compression:
Stored size: 1012 Bytes
Contents
require "helper" class MachineTestSubject include Transitions state_machine do state :open state :closed end state_machine :initial => :foo do event :shutdown do transitions :from => :open, :to => :closed end event :timeout do transitions :from => :open, :to => :closed end end state_machine :extra, :initial => :bar do end end class TransitionsMachineTest < Test::Unit::TestCase test "allows reuse of existing machines" do assert_equal 2, MachineTestSubject.state_machines.size end test "sets #initial_state from :initial option" do assert_equal :bar, MachineTestSubject.state_machine(:extra).initial_state end test "accesses non-default state machine" do assert_kind_of Transitions::Machine, MachineTestSubject.state_machine(:extra) end test "finds events for given state" do events = MachineTestSubject.state_machine.events_for(:open) assert events.include?(:shutdown) assert events.include?(:timeout) end end
Version data entries
10 entries across 10 versions & 1 rubygems