]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - test/plugins/test_rot13.rb
tests: mocked bot and messages added, added points tests
[user/henk/code/ruby/rbot.git] / test / plugins / test_rot13.rb
1 $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2 $:.unshift File.join(File.dirname(__FILE__), '..', '..')
3
4 require 'test/unit'
5 require 'test/mock'
6
7 require 'rbot/ircbot'
8 require 'rbot/registry'
9 require 'rbot/plugins'
10
11
12 class PluginTest < Test::Unit::TestCase
13   def setup
14     manager = Irc::Bot::Plugins.manager
15     manager.bot_associate(MockBot.new)
16     manager.load_botmodule_file('./data/rbot/plugins/rot13.rb')
17     @plugin = manager.get_plugin('rot')
18   end
19
20   def test_rot13
21     assert_not_nil(@plugin)
22     assert_equal(@plugin.help(nil), "rot13 <string> => encode <string> to rot13 or back")
23     m = MockMessage.new
24     @plugin.rot13(m, {string: 'Hello World'})
25     assert_equal(m.replies.first, 'Uryyb Jbeyq')
26   end
27 end