Sha256: 68750fe02459726ff9899d97cf24d269b32f51ecb84c8274f0f9ee0d24220003

Contents?: true

Size: 827 Bytes

Versions: 5

Compression:

Stored size: 827 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 }

  before do
    allow(client).to receive(:self).and_return(Hashie::Mash.new('id' => 'UDEADBEEF'))
  end

  context 'default' do
    it 'does not respond to self' do
      expect(client).to_not receive(:message)
      message_hook.call(client, Hashie::Mash.new(text: "#{SlackRubyBot.config.user} hi", channel: 'channel', user: 'UDEADBEEF'))
    end
  end
  context 'with allow_message_loops=true' do
    before do
      SlackRubyBot::Config.allow_message_loops = true
    end
    it 'responds to self' do
      expect(message: "#{SlackRubyBot.config.user} hi").to respond_with_slack_message('Hi <@user>!')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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