module Boty module RSpec module Bot def self.included(base) base.instance_eval do let(:bot) { bot = Boty::Bot.new( {"id" => "1234", "name" => "bot"}, Boty::Session.new(ENV["SLACK_COMPANY"] || "acme") ) class << bot attr_accessor :_response def say(message) @_response = message end end bot } end def message_event(text) bot.event "type" => "message", "text" => text end end end ::RSpec::Matchers.define :have_responded do |expected| match do |bot| response = bot._response bot._response = nil response == expected end end end end