Sha256: ec3c6bbbd0e48c3602c9e199ebd66f26e355141063ba19e38b678e56c335446f

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

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 <message> - replies to the channel with <message>",
      "@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 <message> - replies to the channel with <message>",
      "@robut help - displays this message",
    ], @plugin.connection.replies
  end
end
  

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
robut-0.3.0 test/unit/plugin/help_test.rb