Sha256: 7929ef7b60cced827e635b03b5320ea638a14962c0965e617008da8c022b8dd1

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 Bytes

Contents

require 'spec_helper'

describe SlackRubyBot::Commands do
  let! :command do
    Class.new(SlackRubyBot::Commands::Base) do
      command 'nil_text'

      def self.call(_client, data, _match)
        send_message client, data.channel, nil
      end
    end
  end

  let(:app) { SlackRubyBot::App.new }
  let(:client) { app.send(:client) }
  let(:message_hook) { SlackRubyBot::Hooks::Message.new }

  it 'ignores nil messages' do
    allow(Giphy).to receive(:random)
    expect(client).to_not receive(:message)
    message_hook.call(client, Hashie::Mash.new(text: nil, channel: 'channel', user: 'user'))
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-ruby-bot-0.8.2 spec/slack-ruby-bot/commands/nil_message_spec.rb
slack-ruby-bot-0.8.1 spec/slack-ruby-bot/commands/nil_message_spec.rb
slack-ruby-bot-0.8.0 spec/slack-ruby-bot/commands/nil_message_spec.rb