summaryrefslogtreecommitdiff
path: root/test/mock.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/mock.rb')
-rw-r--r--test/mock.rb23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/mock.rb b/test/mock.rb
index 511daaba..ba6326db 100644
--- a/test/mock.rb
+++ b/test/mock.rb
@@ -1,7 +1,7 @@
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
$:.unshift File.join(File.dirname(__FILE__), '..')
-#require 'rbot/logger'
-#Irc::Bot::LoggerManager.instance.set_level(5)
+require 'rbot/logger'
+Irc::Bot::LoggerManager.instance.set_level(5)
module Irc
class Bot
@@ -14,11 +14,18 @@ end
class MockBot
- attr_reader :filters, :lang
+ attr_reader :filters, :lang, :messages
+ attr_accessor :config
def initialize
@filters = {}
+ @config = {}
@lang = Irc::Bot::Language.new(self, 'english')
+ @messages = []
+ end
+
+ def say(target, message)
+ @messages << [target, message]
end
def register_filter(name, &block)
@@ -51,11 +58,13 @@ class MockMessage
attr_reader :message
attr_reader :replies
attr_reader :channel
+ attr_reader :replyto
attr_reader :sourcenick
def initialize(message='', source='user')
@message = message
@sourcenick = source
+ @replyto = source
@channel = Irc::Channel.new('#test', '', ['bob'], server: nil)
@replies = []
end
@@ -64,9 +73,17 @@ class MockMessage
@replies << message
end
+ def okay
+ reply 'okay'
+ end
+
def public?
true
end
+
+ def private?
+ false
+ end
end