Sha256: 29800d1b610e97bedc2583197eb220009db9829f1615f7e2ebf1eb9004f0ef6d

Contents?: true

Size: 819 Bytes

Versions: 3

Compression:

Stored size: 819 Bytes

Contents

require 'spec_helper'

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

3 entries across 3 versions & 1 rubygems

Version Path
slack-ruby-bot-0.10.1 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.10.0 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.9.0 spec/slack-ruby-bot/commands/message_loop_spec.rb