class NodeCollectionWithStringIndexTest

Public Instance Methods

setup() click to toggle source
# File test/unit/node_collection_test.rb, line 247
def setup
  machine = StateMachine::Machine.new(Class.new)
  @collection = StateMachine::NodeCollection.new(machine, :index => [:name, :name_to_s, :value])
  
  @parked = Node.new(:parked, 1)
  @collection << @parked
end
test_should_fallback_to_string_index() click to toggle source
# File test/unit/node_collection_test.rb, line 263
def test_should_fallback_to_string_index
  assert_equal @parked, @collection['parked']
end
test_should_index_by_name() click to toggle source
# File test/unit/node_collection_test.rb, line 255
def test_should_index_by_name
  assert_equal @parked, @collection[:parked]
end
test_should_index_by_string_name() click to toggle source
# File test/unit/node_collection_test.rb, line 259
def test_should_index_by_string_name
  assert_equal @parked, @collection['parked', :name_to_s]
end
test_should_not_fallback_to_string_index_if_not_available() click to toggle source
# File test/unit/node_collection_test.rb, line 267
def test_should_not_fallback_to_string_index_if_not_available
  assert_nil @collection['1', :value]
end