Sha256: 43e32fe63323bf71233122467f8da384600efe9f133ec210dcd26eda4ffa8a22
Contents?: true
Size: 757 Bytes
Versions: 14
Compression:
Stored size: 757 Bytes
Contents
require_relative '../../test_helper' class StateCollectionWithCustomStateValuesTest < StateMachinesTest def setup @klass = Class.new @machine = StateMachines::Machine.new(@klass) @states = StateMachines::StateCollection.new(@machine) @states << @state = StateMachines::State.new(@machine, :parked, value: 1) @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 = 2 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