Sha256: 9c588b5aae7da4193bdcbf037fc7180edd7489819c47805559442c5eb6174f71
Contents?: true
Size: 962 Bytes
Versions: 3
Compression:
Stored size: 962 Bytes
Contents
require "minitest/autorun" require "cognition" require_relative "fixtures/hello" class CognitionTest < Minitest::Test def setup @bot = Cognition::Bot.new end def test_registers_plugins @bot.register(Hello) assert_equal 2, @bot.plugin_names.count end def test_does_not_register_duplicate_plugins @bot.register(Hello) @bot.register(Hello) assert_equal 2, @bot.plugin_names.count end def test_processes_messages msg = Cognition::Message.new("ping") assert_equal "PONG", @bot.process(msg) end def test_processes_strings assert_equal "PONG", @bot.process("ping") end def test_processes_strings_with_metadata assert_equal "PONG", @bot.process("ping", foo: "bar") end def test_shows_help_if_no_matches @bot.register(Hello) msg = Cognition::Message.new("pong") output = @bot.process(msg) assert_match "No such command: pong\nUse 'help' for available commands!", output end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cognition-2.0.7 | test/test_cognition.rb |
cognition-2.0.6 | test/test_cognition.rb |
cognition-2.0.5 | test/test_cognition.rb |