Sha256: 0585c1c0597fa6996d401a5fedc82403409f3d6611e890dc9dfc47ec51b31ea4
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
module Boty module RSpec module Bot require File.expand_path "../../../spec/support/slack_support", __FILE__ def self.included(base) base.instance_eval do include SlackSupport::Users before do @_bot = Boty::Bot.new("id" => "1234", "name" => "bot") mock_post_message end let(:bot) { Boty::DSL.new @_bot } end end def mock_post_message class << Boty::Slack.chat attr_accessor :messages def post_message(message, options) @messages ||= [] @messages << { message: message, options: options } end end end def event(options) @_bot.event({ "type" => "message" }.merge options) end def message(text) event "text" => text end end ::RSpec::Matchers.define :have_responded do |expected| # TODO: add proper messages for failures. match do last_message = Slack.chat.messages.last expected == last_message[:message] end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
boty-1.0.1 | lib/boty/rspec.rb |
boty-1.0.0 | lib/boty/rspec.rb |
boty-0.2.0 | lib/boty/rspec.rb |
boty-0.1.2 | lib/boty/rspec.rb |
boty-0.1.1 | lib/boty/rspec.rb |