test/test_cognition.rb in cognition-1.2.1 vs test/test_cognition.rb in cognition-2.0.0

- old
+ new

@@ -2,41 +2,41 @@ require 'cognition' require_relative 'fixtures/hello' class CognitionTest < Minitest::Test def setup - Cognition.reset + @bot = Cognition::Bot.new end def test_registers_plugins - Cognition.register(Hello) + @bot.register(Hello) - assert_equal 2, Cognition.plugin_names.count + assert_equal 2, @bot.plugin_names.count end def test_does_not_register_duplicate_plugins - Cognition.register(Hello) - Cognition.register(Hello) + @bot.register(Hello) + @bot.register(Hello) - assert_equal 2, Cognition.plugin_names.count + assert_equal 2, @bot.plugin_names.count end def test_processes_messages msg = Cognition::Message.new('ping') - assert_equal 'PONG', Cognition.process(msg) + assert_equal 'PONG', @bot.process(msg) end def test_processes_strings - assert_equal 'PONG', Cognition.process('ping') + assert_equal 'PONG', @bot.process('ping') end def test_processes_strings_with_metadata - assert_equal 'PONG', Cognition.process('ping', foo: 'bar') + assert_equal 'PONG', @bot.process('ping', foo: 'bar') end def test_shows_help_if_no_matches - Cognition.register(Hello) + @bot.register(Hello) msg = Cognition::Message.new('pong') - output = Cognition.process(msg) + output = @bot.process(msg) assert_match "No such command: pong\nUse 'help' for available commands!", output end end