test/unit/connection_test.rb in robut-0.2.1 vs test/unit/connection_test.rb in robut-0.3.0

- old
+ new

@@ -1,8 +1,9 @@ require 'test_helper' class SimplePlugin + include Robut::Plugin attr_accessor :run def initialize(*args) super(*args) @run = false @@ -11,21 +12,25 @@ def handle(*args) self.run = true end end -class ReplyToUserPlugin < Robut::Plugin::Base +class ReplyToUserPlugin + include Robut::Plugin + def initialize(*args) super(*args) end def handle(time, nick, message) reply("Reply", nick) end end -class ReplyToRoomPlugin < Robut::Plugin::Base +class ReplyToRoomPlugin + include Robut::Plugin + def initialize(*args) super(*args) end def handle(time, nick, message) @@ -37,11 +42,11 @@ attr_accessor :messages def initialize @messages = [] end - + def send(message) @messages << message end def room @@ -94,11 +99,11 @@ justin => OpenStruct.new({ :iname => "Justin Weiss" }) } }) - + @connection.handle_message(plugins(@connection), Time.now, 'justin WEISS', 'Test Message') message = @connection.client.messages.first assert_equal(justin, message.to.to_s) assert_equal(:chat, message.type) assert_equal("Reply", message.body) @@ -117,7 +122,7 @@ private def plugins(connection, sender = nil) Robut::Plugin.plugins.map { |p| p.new(connection, sender) } end - + end