Sha256: fc0d29f78b3d4289319fc70d8f120b1604f533858cfbe96d005458ed772eb985
Contents?: true
Size: 781 Bytes
Versions: 14
Compression:
Stored size: 781 Bytes
Contents
require_relative '../../test_helper' class StateCollectionWithStateMatchersTest < StateMachinesTest def setup @klass = Class.new @machine = StateMachines::Machine.new(@klass) @states = StateMachines::StateCollection.new(@machine) @states << @state = StateMachines::State.new(@machine, :parked, if: lambda { |value| !value.nil? }) @machine.states.concat(@states) @object = @klass.new @object.state = 1 end def test_should_match_if_value_matches assert @states.matches?(@object, :parked) end def test_should_not_match_if_value_does_not_match @object.state = nil refute @states.matches?(@object, :parked) end def test_should_find_state_for_object_if_value_is_known assert_equal @state, @states.match(@object) end end
Version data entries
14 entries across 14 versions & 2 rubygems