Sha256: 8e3d91c383052df2f1092f7589d0d776e98bb1ac7e80e359870a30e82cd21c1f

Contents?: true

Size: 823 Bytes

Versions: 14

Compression:

Stored size: 823 Bytes

Contents

require_relative '../../test_helper'
require_relative '../../files/node'

class NodeCollectionWithMatcherContextsTest < StateMachinesTest
  def setup
    machine = StateMachines::Machine.new(Class.new)
    @collection = StateMachines::NodeCollection.new(machine)
    @collection << Node.new(:parked)
  end

  def test_should_always_run_all_matcher_context
    contexts_run = []
    @collection.context([StateMachines::AllMatcher.instance]) { contexts_run << :all }
    assert_equal [:all], contexts_run
  end

  def test_should_only_run_blacklist_matcher_if_not_matched
    contexts_run = []
    @collection.context([StateMachines::BlacklistMatcher.new([:parked])]) { contexts_run << :blacklist }
    assert_equal [], contexts_run

    @collection << Node.new(:idling)
    assert_equal [:blacklist], contexts_run
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
state_machines-0.5.0 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.4.0 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.3.0 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.2.2 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.2.1 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.2.0 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.1.4 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.1.3 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.1.2 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.1.1 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb
state_machines-0.1.0 test/unit/node_collection/node_collection_with_matcher_contexts_test.rb