class NodeCollectionWithMatcherContextsTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/node_collection_test.rb, line 314 def setup machine = StateMachine::Machine.new(Class.new) @collection = StateMachine::NodeCollection.new(machine) @collection << Node.new(:parked) end
test_should_always_run_all_matcher_context()
click to toggle source
# File test/unit/node_collection_test.rb, line 320 def test_should_always_run_all_matcher_context contexts_run = [] @collection.context([StateMachine::AllMatcher.instance]) { contexts_run << :all } assert_equal [:all], contexts_run end
test_should_only_run_blacklist_matcher_if_not_matched()
click to toggle source
# File test/unit/node_collection_test.rb, line 326 def test_should_only_run_blacklist_matcher_if_not_matched contexts_run = [] @collection.context([StateMachine::BlacklistMatcher.new([:parked])]) { contexts_run << :blacklist } assert_equal [], contexts_run @collection << Node.new(:idling) assert_equal [:blacklist], contexts_run end