class BranchDrawingTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/branch_test.rb, line 762 def setup @machine = StateMachine::Machine.new(Class.new) states = [:parked, :idling] graph = GraphViz.new('G') states.each {|state| graph.add_node(state.to_s)} @branch = StateMachine::Branch.new(:from => :idling, :to => :parked) @edges = @branch.draw(graph, :park, states) end
test_should_create_edges()
click to toggle source
# File test/unit/branch_test.rb, line 773 def test_should_create_edges assert_equal 1, @edges.size end
test_should_use_event_name_as_label()
click to toggle source
# File test/unit/branch_test.rb, line 785 def test_should_use_event_name_as_label assert_equal 'park', @edges.first['label'].to_s.gsub('"', '') end
test_should_use_from_state_from_start_node()
click to toggle source
# File test/unit/branch_test.rb, line 777 def test_should_use_from_state_from_start_node assert_equal 'idling', @edges.first.instance_variable_get('@xNodeOne') end
test_should_use_to_state_for_end_node()
click to toggle source
# File test/unit/branch_test.rb, line 781 def test_should_use_to_state_for_end_node assert_equal 'parked', @edges.first.instance_variable_get('@xNodeTwo') end