Sha256: 966fa2460c0920bb6fe02a30fc26ef54b457d110b67c7816ea1782a674400271
Contents?: true
Size: 1.21 KB
Versions: 14
Compression:
Stored size: 1.21 KB
Contents
require_relative '../../test_helper' class PathWithAvailableTransitionsAfterReachingTargetTest < StateMachinesTest def setup @klass = Class.new @machine = StateMachines::Machine.new(@klass) @machine.state :parked, :idling @machine.event :ignite do transition parked: :idling end @machine.event :shift_up do transition parked: :first_gear end @machine.event :park do transition [:idling, :first_gear] => :parked end @object = @klass.new @object.state = 'parked' @path = StateMachines::Path.new(@object, @machine, target: :parked) @path.concat([ @ignite_transition = StateMachines::Transition.new(@object, @machine, :ignite, :parked, :idling), @park_transition = StateMachines::Transition.new(@object, @machine, :park, :idling, :parked) ]) end def test_should_be_complete assert_equal true, @path.complete? end def test_should_be_able_to_walk paths = [] @path.walk { |path| paths << path } assert_equal [ [@ignite_transition, @park_transition, StateMachines::Transition.new(@object, @machine, :shift_up, :parked, :first_gear)] ], paths end end
Version data entries
14 entries across 14 versions & 2 rubygems