Sha256: 8d5ef135e6de89c902c1a6c64621c1ccbfaa325c994136c6b11438622a11eef0

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe SlackRubyBot::App do
  def app
    SlackRubyBot::App.new
  end
  let(:client) { subject.send(:client) }
  before do
    allow(client).to receive(:self).and_return('id' => 'UDEADBEEF')
    allow(Giphy).to receive(:random)
  end
  context 'default' do
    it 'does not respond to self' do
      expect(SlackRubyBot::Commands::Base).to_not receive(:send_client_message)
      subject.send(:message, client, text: "#{SlackRubyBot.config.user} hi", channel: 'channel', user: 'UDEADBEEF')
    end
  end
  context 'with allow_message_loops=true' do
    before do
      SlackRubyBot.configure do |config|
        config.allow_message_loops = true
      end
    end
    after do
      SlackRubyBot.configure do |config|
        config.allow_message_loops = nil
      end
    end
    it 'responds to self' do
      expect(SlackRubyBot::Commands::Base).to receive(:send_client_message)
      subject.send(:message, client, text: "#{SlackRubyBot.config.user} hi", channel: 'channel', user: 'UDEADBEEF')
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
slack-ruby-bot-bhe-0.5.5.3 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.5.5 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.5.4 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.5.3 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.5.2 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.5.1 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.5.0 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.4.5 spec/slack-ruby-bot/commands/message_loop_spec.rb