test/participant_test.rb in openwferu-0.9.16 vs test/participant_test.rb in openwferu-0.9.17
- old
+ new
@@ -58,6 +58,42 @@
assert @engine.unregister_participant("user_.*")
assert_equal 0, @engine.get_participant_map.size
end
+ def test_order
+
+ s = ""
+
+ @engine.register_participant "a.*", :astar
+ @engine.register_participant "alpha", :alpha
+
+ assert_equal :astar, @engine.get_participant("alpha")
+
+ clean_participants
+
+ @engine.register_participant "alpha", :alpha
+ @engine.register_participant "a.*", :astar
+
+ assert_equal :alpha, @engine.get_participant("alpha")
+
+ clean_participants
+
+ @engine.register_participant "a.*", :astar
+
+ assert_equal :astar, @engine.get_participant("alpha")
+
+ @engine.register_participant "alpha", { :participant => :alpha, :position => :first }
+
+ assert_equal :alpha, @engine.get_participant("alpha")
+ assert_equal :astar, @engine.get_participant("abricot")
+ end
+
+ protected
+
+ def clean_participants
+
+ @engine.get_participant_map.instance_variable_set(
+ :@participants, [])
+ end
+
end