Sha256: a3f4bda0a9ba1865bf750bd981ba85bf8e63d172ca67769ecaf2edb2ca5bed82

Contents?: true

Size: 796 Bytes

Versions: 8

Compression:

Stored size: 796 Bytes

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
slack-ruby-bot-0.12.0 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.11.2 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.11.1 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.11.0 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.10.5 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.10.4 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.10.3 spec/slack-ruby-bot/commands/message_loop_spec.rb
slack-ruby-bot-0.10.2 spec/slack-ruby-bot/commands/message_loop_spec.rb