Sha256: 90a8f703c3ca1e91f000d2c8394f76512d0fee959b822e2ef431aaf812d9837c

Contents?: true

Size: 537 Bytes

Versions: 14

Compression:

Stored size: 537 Bytes

Contents

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

class NodeCollectionWithSymbolIndexTest < StateMachinesTest
  def setup
    machine = StateMachines::Machine.new(Class.new)
    @collection = StateMachines::NodeCollection.new(machine, index: [:name, :value])

    @parked = Node.new('parked', 1)
    @collection << @parked
  end

  def test_should_index_by_name
    assert_equal @parked, @collection['parked']
  end

  def test_should_index_by_symbol_name
    assert_equal @parked, @collection[:parked]
  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_symbol_index_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/node_collection/node_collection_with_symbol_index_test .rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/node_collection/node_collection_with_symbol_index_test .rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/node_collection/node_collection_with_symbol_index_test .rb
state_machines-0.4.0 test/unit/node_collection/node_collection_with_symbol_index_test.rb
state_machines-0.3.0 test/unit/node_collection/node_collection_with_symbol_index_test.rb
state_machines-0.2.2 test/unit/node_collection/node_collection_with_symbol_index_test .rb
state_machines-0.2.1 test/unit/node_collection/node_collection_with_symbol_index_test .rb
state_machines-0.2.0 test/unit/node_collection/node_collection_with_symbol_index_test .rb
state_machines-0.1.4 test/unit/node_collection/node_collection_with_symbol_index_test .rb
state_machines-0.1.3 test/unit/node_collection/node_collection_with_symbol_index_test .rb
state_machines-0.1.2 test/unit/node_collection/node_collection_with_symbol_index_test .rb
state_machines-0.1.1 test/unit/node_collection/node_collection_with_symbol_index_test .rb
state_machines-0.1.0 test/unit/node_collection/node_collection_with_symbol_index_test .rb