Sha256: 6920b75a54cda920084b1b10aad491e7ba56fb3d9632b5f68ab2303f0f9ef1ed

Contents?: true

Size: 1.14 KB

Versions: 11

Compression:

Stored size: 1.14 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
    @presence = Robut::PresenceMock.new(@connection)
    Robut::Plugin.plugins << Robut::Plugin::Echo
    Robut::Plugin.plugins << Robut::Plugin::Help
    @plugin = Robut::Plugin::Help.new(@presence)
  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.reply_to.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.reply_to.replies
  end
end
  

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
sclemmer-robut-0.6.3 test/unit/plugin/help_test.rb
sclemmer-robut-0.6.2 test/unit/plugin/help_test.rb
sclemmer-robut-0.6.1 test/unit/plugin/help_test.rb
sclemmer-robut-0.6.0 test/unit/plugin/help_test.rb
sclemmer-robut-0.5.4 test/unit/plugin/help_test.rb
sclemmer-robut-0.5.3 test/unit/plugin/help_test.rb
sclemmer-robut-0.5.2 test/unit/plugin/help_test.rb
robut-0.5.2 test/unit/plugin/help_test.rb
robut-0.5.1 test/unit/plugin/help_test.rb
robut-0.5.0 test/unit/plugin/help_test.rb
robut-0.4.0 test/unit/plugin/help_test.rb