Sha256: ad138baec53dc3609b83341a309cf5dbeb44ec332985798d2b62020f432c3928
Contents?: true
Size: 807 Bytes
Versions: 7
Compression:
Stored size: 807 Bytes
Contents
# frozen_string_literal: true require 'rspec/expectations' RSpec::Matchers.define :not_respond do match do |actual| client = respond_to?(:client) ? send(:client) : SlackRubyBot::Client.new 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
7 entries across 7 versions & 2 rubygems