0
@@ -19,18 +19,23 @@ describe RedSteak do
0
@@ -38,17 +43,15 @@ describe RedSteak do
0
def guard(machine, trans, *args)
0
- @_guard
= @_args = args0
+ @_guard
<< (@_args = args)0
def a_to_b?(machine, trans, *args)
0
- @_guard = @_args = args
0
+ guard(machine, trans, *args)
0
@@ -56,7 +59,7 @@ describe RedSteak do
0
def effect(machine, trans, *args)
0
- @_effect
= @_args = args0
+ @_effect
<< (@_args = args)0
@@ -64,7 +67,8 @@ describe RedSteak do
0
def enter(machine, state, *args)
0
- @_enter = @_args = args
0
+ @_enter << [ state.to_s, *args ]
0
@@ -72,7 +76,8 @@ describe RedSteak do
0
def exit(machine, state, *args)
0
- @_exit = @_args = args
0
+ @_exit << [ state.to_s, *args ]
0
@@ -80,7 +85,8 @@ describe RedSteak do
0
def doActivity(machine, state, *args)
0
- @_doActivity = @_args = args
0
+ @_doActivity << [ state.to_s, *args ]
0
@@ -296,11 +302,11 @@ describe RedSteak do
0
c._state.should == m.stateMachine.states[:a]
0
c._transition.should == nil
0
- c._guard.should == nil
0
- c._effect.should == nil
0
- # c._enter.should == [ ]
0
- c._doActivity.should == [ ]
0
+ c._guard.should == [ ]
0
+ c._effect.should == [ ]
0
+ c._enter.should == [ [ "a" ] ]
0
+ c._doActivity.should == [ [ "a" ] ]
0
m.history.size.should == 1
0
#################################
0
@@ -308,7 +314,7 @@ describe RedSteak do
0
- m.transition! "a_to_b", :arg
0
+ m.transition! "a_to_b", :arg
10
m.at_start?.should == false
0
m.at_end?.should == false
0
@@ -317,13 +323,13 @@ describe RedSteak do
0
c._transition.name.should == :a_to_b
0
- c._guard.should == [ :arg ]
0
- c._a_to_b.should == [ :arg ]
0
- c._effect.should == [ :arg ]
0
+ c._guard.should == [ [ :arg1 ] ]
0
+ c._a_to_b.should == [ :arg1 ]
0
+ c._effect.should == [ [ :arg1 ] ]
0
c._state.name.should == :b
0
- c._enter.should == [ :arg ]
0
- c._exit.should == [ :arg ]
0
- c._doActivity.should == [ :arg ]
0
+ c._enter.should == [ [ "b", :arg1 ] ]
0
+ c._exit.should == [ [ "a", :arg1 ] ]
0
+ c._doActivity.should == [ [ "b", :arg1 ] ]
0
m.history.size.should == 2
0
#################################
0
@@ -504,8 +510,8 @@ describe RedSteak do
0
m.state.name.should == :a
0
c._state.name.should == :a
0
- c._enter.should == [ :foo, :bar ]
0
+ c._enter.should == [ [ "a", :foo, :bar ] ]
0
render_graph m, :show_history => true
0
@@ -596,14 +602,34 @@ describe RedSteak do
0
sm.state[:c].state.map{|s| s.to_s}.should == [ ]
0
sm.state[:c].source.map{|s| s.to_s}.should == ["a::a", "a::b", "a::c", "b", "b::a"]
0
+ m = machine_with_context(sm)
0
+ c._enter.should == [ [ "a" ], [ "a::a" ] ]
0
+ c._exit.should == [["a::a"], ["a"]]
0
+ c._enter.should == [ [ "b" ], [ "b::a" ] ]
0
m.transition_to! "b::b"
0
+ c._exit.should == [["b::a"]]
0
+ c._enter.should == [["b::b"]]
0
m.transition_to! "a::b"
0
+ c._exit.should == [["b::b"], ["b"]]
0
+ c._enter.should == [["a"], ["a::b"]]
0
+ c._exit.should == [["a::b"], ["a"]]
0
+ c._enter.should == [["c"]]
0
render_graph m, :show_history => true