class BranchDrawingWithFromRequirementTest

Public Instance Methods

setup() click to toggle source
# File test/unit/branch_test.rb, line 791
def setup
  @machine = StateMachine::Machine.new(Class.new)
  states = [:parked, :idling, :first_gear]
  
  graph = GraphViz.new('G')
  states.each {|state| graph.add_node(state.to_s)}
  
  @branch = StateMachine::Branch.new(:from => [:idling, :first_gear], :to => :parked)
  @edges = @branch.draw(graph, :park, states)
end
test_should_generate_edges_for_each_valid_from_state() click to toggle source
# File test/unit/branch_test.rb, line 802
def test_should_generate_edges_for_each_valid_from_state
  [:idling, :first_gear].each_with_index do |from_state, index|
    edge = @edges[index]
    assert_equal from_state.to_s, edge.instance_variable_get('@xNodeOne')
    assert_equal 'parked', edge.instance_variable_get('@xNodeTwo')
  end
end