diff options
author | Matthias Hecker <mail@apoc.cc> | 2020-04-01 15:48:02 +0200 |
---|---|---|
committer | Matthias Hecker <mail@apoc.cc> | 2020-04-01 15:48:02 +0200 |
commit | b22038a43a626915c6f70debf63f732053309a75 (patch) | |
tree | c2bb57d717caffc3c150c0133bce18413ca9098f /test/plugins/test_rot13.rb | |
parent | 201901b959ad7f8b6d30f2867ee06c213c093e4b (diff) |
plugin(rot13): test assert added
Diffstat (limited to 'test/plugins/test_rot13.rb')
-rw-r--r-- | test/plugins/test_rot13.rb | 20 |
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 |