1 $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2 $:.unshift File.join(File.dirname(__FILE__), '..', '..')
8 require 'rbot/registry'
12 class NotePluginTest < Test::Unit::TestCase
15 @bot.config['note.private_message'] = false
16 manager = Irc::Bot::Plugins.manager
17 manager.bot_associate(@bot)
18 manager.load_botmodule_file('./data/rbot/plugins/note.rb')
19 @plugin = manager.get_plugin('note')
23 assert_not_nil(@plugin)
24 assert_equal(@plugin.help(nil), 'note <nick> <string> => stores a note (<string>) for <nick>')
28 @plugin.note(m, {nick: 'AlIcE', string: 'Hello Alice!'})
29 assert_equal(1, m.replies.size)
30 assert_equal('okay', m.replies.first)
32 m = MockMessage.new('', 'Alice')
34 assert_equal(1, @bot.messages.size)
35 to, message = @bot.messages.first
36 assert_equal('Alice', to)
37 assert_match(/you have notes!/, message)
38 assert_match(/<user> Hello Alice!/, message)