X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=test%2Ftest_plugins_priority.rb;h=ab66a62d60d9f36e6e2c5f86ee7d701396732123;hb=613750983b43546d8bd2732c9159ff766a1c42bd;hp=755965586adcd5544fa0b5e5e5960024f1d6ab58;hpb=9718c29c6e9daf9227d0a750e6419640eff50276;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/test/test_plugins_priority.rb b/test/test_plugins_priority.rb index 75596558..ab66a62d 100644 --- a/test/test_plugins_priority.rb +++ b/test/test_plugins_priority.rb @@ -4,6 +4,7 @@ require 'test/unit' require 'rbot/config' require 'rbot/plugins' +require 'pp' include Irc::Bot::Plugins @@ -45,7 +46,7 @@ class PluginsPriorityTest < Test::Unit::TestCase @mock3 = MockModule.new(3) @mock4 = MockModule.new(4) @mock5 = MockModule.new(5) - + # This whole thing is a PITA because PluginManagerClass is a singleton unless @@manager @@manager = PluginManagerClass.instance @@ -62,9 +63,10 @@ class PluginsPriorityTest < Test::Unit::TestCase @@manager.instance_eval { @sort_call_count = nil } @@manager.mark_priorities_dirty - # We add the modules to the lists in the wrong order + # We add the modules to the lists in the wrong order # on purpose to make sure the sort is working @@manager.plugins.clear + @@manager.core_modules.clear @@manager.plugins << @mock1 @@manager.plugins << @mock4 @@manager.plugins << @mock3 @@ -79,7 +81,7 @@ class PluginsPriorityTest < Test::Unit::TestCase dlist << @mock2 dlist << @mock5 end - + def test_default_priority plugin = TestRealBotModule.new assert_equal 1, plugin.priority @@ -161,7 +163,13 @@ class PluginsPriorityTest < Test::Unit::TestCase assert @mock3.connect_called_at.first < @mock4.connect_called_at.first assert @mock4.connect_called_at.first < @mock5.connect_called_at.first end -end - + def test_add_botmodule + @@manager.sort_modules + mock_n1 = MockModule.new(-1) + @@manager.add_botmodule mock_n1 + @@manager.delegate('test') + assert mock_n1.test_called_at.first < @mock1.test_called_at.first + end +end