require 'test_helper' require 'robut/plugin/echo' require 'robut/plugin/help' class Robut::Plugin::PluginWithoutHelp include Robut::Plugin def usage super end end class Robut::Plugin::HelpTest < Test::Unit::TestCase def setup @connection = Robut::ConnectionMock.new Robut::Plugin.plugins << Robut::Plugin::Echo Robut::Plugin.plugins << Robut::Plugin::Help @plugin = Robut::Plugin::Help.new(@connection) end def teardown Robut::Plugin.plugins = [] end def test_help @plugin.handle(Time.now, "@justin", "@robut help") assert_equal [ "Supported commands:", "@robut echo - replies to the channel with ", "@robut help - displays this message", ], @plugin.connection.replies end def test_empty_help Robut::Plugin.plugins << Robut::Plugin::PluginWithoutHelp @plugin.handle(Time.now, "@justin", "@robut help") assert_equal [ "Supported commands:", "@robut echo - replies to the channel with ", "@robut help - displays this message", ], @plugin.connection.replies end end