Mon Aug 20 08:01:21 EST 2007 Matt Palmer * Rework some auth-related bits of the mockbot so it works properly (Indrek Juhkam) diff -rN -u old-trac_urls/test/lib/mockbot_classes.rb new-trac_urls/test/lib/mockbot_classes.rb --- old-trac_urls/test/lib/mockbot_classes.rb 2008-10-20 23:31:04.171857475 +1100 +++ new-trac_urls/test/lib/mockbot_classes.rb 2008-10-20 23:31:04.191857459 +1100 @@ -25,13 +25,6 @@ end end -class IrcAuth # :nodoc: - def initialize(a) - @users = Hash.new {|k,v| x = Struct.new(:level).new; x.level = 1; x } - @levels = Hash.new(0) - end -end - module Plugins class PluginManagerClass def load_module(f) diff -rN -u old-trac_urls/test/lib/mockbot.rb new-trac_urls/test/lib/mockbot.rb --- old-trac_urls/test/lib/mockbot.rb 2008-10-20 23:31:04.171857475 +1100 +++ new-trac_urls/test/lib/mockbot.rb 2008-10-20 23:31:04.191857459 +1100 @@ -1,5 +1,5 @@ -require File.dirname(__FILE__) + '/mockbot_classes.rb' require 'rbot/load-gettext' +require 'mockbot_classes.rb' require 'rbot/messagemapper' require 'rbot/message' require 'rbot/plugins' @@ -16,7 +16,7 @@ def initialize(botname, plugindir) @nick = botname @botclass = @nick - @auth = Irc::IrcAuth.new(self) + @auth = Irc::Auth.authmanager @replies = [] @config = Irc::BotConfig.configmanager @pluginmanager = Irc::Plugins.manager diff -rN -u old-trac_urls/test/test_the_testing_framework.rb new-trac_urls/test/test_the_testing_framework.rb --- old-trac_urls/test/test_the_testing_framework.rb 2008-10-20 23:31:04.171857475 +1100 +++ new-trac_urls/test/test_the_testing_framework.rb 2008-10-20 23:31:04.191857459 +1100 @@ -37,10 +37,15 @@ end def test_message_map - load_plugin_from_string("class Reflector < Plugin; def ping(m, params); m.reply('pong %s' % m.message.sub(/^ping /, '')); end; end; plugin = Reflector.new; plugin.map('ping *anything')") + assert_equal 0, @bot.pluginmanager.length + load_plugin_from_string("class Reflector < Plugin; def pinggg(m, params); m.reply('pong %s' % m.message.sub(/^pinggg /, '')); end; end; plugin = Reflector.new; plugin.map('pinggg *anything')") assert_equal 1, @bot.pluginmanager.length + assert_no_rbot_errors - @bot.message(:target => '#channel', :sourcenick => 'somebody', :content => "#{@bot.nick}: ping something funny") + @bot.message :target => '#channel', + :sourcenick => 'somebody', + :content => "#{@bot.nick}: pinggg something funny" + assert_no_rbot_errors assert_equal 1, @bot.replies.length assert_equal({:target => '#channel', :content => 'pong something funny'}, @bot.replies[0])