Sha256: 96d338e7cd266862ba416c20f71843a53e7b4564b48debe2f29356eb22c29e40
Contents?: true
Size: 840 Bytes
Versions: 4
Compression:
Stored size: 840 Bytes
Contents
require 'rspec/expectations' RSpec::Matchers.define :not_respond do match do |actual| client = if respond_to?(:client) send(:client) else SlackRubyBot::Client.new end message_command = SlackRubyBot::Hooks::Message.new channel, user, message, attachments = parse(actual) expect(client).not_to receive(:message) message_command.call(client, Hashie::Mash.new(text: message, channel: channel, user: user, attachments: attachments)) true end private def parse(actual) actual = { message: actual } unless actual.is_a?(Hash) attachments = actual[:attachments] attachments = [attachments] unless attachments.nil? || attachments.is_a?(Array) [actual[:channel] || 'channel', actual[:user] || 'user', actual[:message], attachments] end end
Version data entries
4 entries across 4 versions & 1 rubygems