blob: fafb58bacda670628fc7ac06e93708ea78423de8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
require 'test/unit'
require 'test/mock'
require 'rbot/ircbot'
require 'rbot/registry'
require 'rbot/plugins'
class PluginTest < Test::Unit::TestCase
def setup
manager = Irc::Bot::Plugins.manager
manager.bot_associate(MockBot.new)
manager.load_botmodule_file('./data/rbot/plugins/rot13.rb')
@plugin = manager.get_plugin('rot')
end
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.replies.first, 'Uryyb Jbeyq')
end
end
|