Class: Cinch::Test::MockMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/cinch/test.rb

Overview

Mock class to present Message objects in a more simple fashion

Instance Method Summary collapse

Constructor Details

#initialize(msg, bot, opts = {}) ⇒ MockMessage

Returns a new instance of MockMessage.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cinch/test.rb', line 50

def initialize(msg, bot, opts = {})
  # override the message-parsing stuff
  super(nil, bot)
  @message = msg
  @user = Cinch::User.new(opts.delete(:nick) { 'test' }, bot)
  if opts.key?(:channel)
    @channel = Cinch::Channel.new(opts.delete(:channel), bot)
    @target = @channel
  else
    @target = @user
  end

  @bot.user_list.find_ensured(nil, @user.nick, nil)
end