test/test_cognition.rb in cognition-1.0.0 vs test/test_cognition.rb in cognition-1.0.1
- old
+ new
@@ -8,14 +8,20 @@
end
def test_registers_plugins
Cognition.register(Hello)
- assert_equal 2, Cognition.plugins.count
- assert_instance_of Hello, Cognition.plugins.last
+ assert_equal 2, Cognition.plugin_names.count
end
+ def test_does_not_register_duplicate_plugins
+ Cognition.register(Hello)
+ Cognition.register(Hello)
+
+ assert_equal 2, Cognition.plugin_names.count
+ end
+
def test_processes_messages
msg = Cognition::Message.new('ping')
assert_equal 'PONG', Cognition.process(msg)
end
@@ -29,10 +35,8 @@
def test_shows_help_if_no_matches
Cognition.register(Hello)
msg = Cognition::Message.new('pong')
output = Cognition.process(msg)
- assert_match 'No such command:', output
- assert_match 'ping: Returns "PONG"', output
- assert_match 'hello: Returns Hello World', output
+ assert_match "No such command: pong\nUse 'help' for available commands!", output
end
end