Sha256: 60b18839cbc9de13dd2de7a58d02cbbef7d29fab3be36d650b692f1b15ae14f8

Contents?: true

Size: 768 Bytes

Versions: 4

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

describe SlackRubyBot::App do
  def app
    SlackRubyBot::App.new
  end

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

  context 'default' do
    it 'does not respond to bot messages' do
      expect(client).to_not receive(:message)
      message_hook.call(client, Hashie::Mash.new(text: "#{SlackRubyBot.config.user} hi", subtype: 'bot_message'))
    end
  end
  context 'with allow_bot_messages=true' do
    before do
      SlackRubyBot::Config.allow_bot_messages = true
    end
    it 'responds to self' do
      expect(client).to receive(:message)
      message_hook.call(client, Hashie::Mash.new(text: "#{SlackRubyBot.config.user} hi", subtype: 'bot_message'))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
slack-ruby-bot-0.16.1 spec/slack-ruby-bot/commands/bot_messages_spec.rb
slack-ruby-bot-0.16.0 spec/slack-ruby-bot/commands/bot_messages_spec.rb
slack-ruby-bot-0.15.0 spec/slack-ruby-bot/commands/bot_messages_spec.rb
slack-ruby-bot-0.14.0 spec/slack-ruby-bot/commands/bot_messages_spec.rb