summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/plugins/test_rot13.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/plugins/test_rot13.rb b/test/plugins/test_rot13.rb
index a8223532..aa4bb185 100644
--- a/test/plugins/test_rot13.rb
+++ b/test/plugins/test_rot13.rb
@@ -25,6 +25,10 @@ class MockBot
@filters[name] = block
end
+ def filter(name, value)
+ @filters[name].call({text: value})[:text]
+ end
+
def path
''
end
@@ -35,6 +39,19 @@ class MockBot
end
+class MockMessage
+ attr_reader :messages
+
+ def initialize
+ @messages = []
+ end
+
+ def reply(message)
+ @messages << message
+ end
+end
+
+
class PluginTest < Test::Unit::TestCase
def setup
manager = Irc::Bot::Plugins.manager
@@ -46,5 +63,8 @@ class PluginTest < Test::Unit::TestCase
def test_rot13
assert_not_nil(@plugin)
assert_equal(@plugin.help(nil), "rot13 <string> => encode <string> to rot13 or back")
+ m = MockMessage.new
+ @plugin.rot13(m, {string: 'Hello World'})
+ assert_equal(m.messages.first, 'Uryyb Jbeyq')
end
end