class NodeCollectionAfterUpdateTest

Public Instance Methods

setup() click to toggle source
# File test/unit/node_collection_test.rb, line 213
def setup
  machine = StateMachine::Machine.new(Class.new)
  @collection = StateMachine::NodeCollection.new(machine, :index => [:name, :value])
  
  @parked = Node.new(:parked, 1)
  @idling = Node.new(:idling, 2)
  
  @collection << @parked << @idling
  
  @parked.name = :parking
  @parked.value = 0
  @collection.update(@parked)
end
test_should_add_each_indexed_key() click to toggle source
# File test/unit/node_collection_test.rb, line 235
def test_should_add_each_indexed_key
  assert_equal @parked, @collection[:parking]
  assert_equal @parked, @collection[0, :value]
end
test_should_not_change_the_index() click to toggle source
# File test/unit/node_collection_test.rb, line 227
def test_should_not_change_the_index
  assert_equal @parked, @collection.at(0)
end
test_should_not_duplicate_in_the_collection() click to toggle source
# File test/unit/node_collection_test.rb, line 231
def test_should_not_duplicate_in_the_collection
  assert_equal 2, @collection.length
end
test_should_remove_each_old_indexed_key() click to toggle source
# File test/unit/node_collection_test.rb, line 240
def test_should_remove_each_old_indexed_key
  assert_nil @collection[:parked]
  assert_nil @collection[1, :value]
end