Sha256: 3ce30e5c553e678b0e029f4beef019ae6929a6c297c1077601f2ec546865d3d6

Contents?: true

Size: 1.68 KB

Versions: 5

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

describe SlackRubyBot do
  def app
    SlackRubyBot::App.new
  end
  context 'it responds to direct messages' do
    it 'with bot name' do
      expect(message: "#{SlackRubyBot.config.user} hi", channel: 'DEADBEEF').to respond_with_slack_message('Hi <@user>!')
    end
    it 'with bot name capitalized' do
      expect(message: "#{SlackRubyBot.config.user.upcase} hi", channel: 'DEADBEEF').to respond_with_slack_message('Hi <@user>!')
    end
    it 'with bot user id' do
      expect(message: "<@#{SlackRubyBot.config.user_id}> hi", channel: 'DEADBEEF').to respond_with_slack_message('Hi <@user>!')
    end
    it 'without bot name' do
      expect(message: 'hi', channel: 'DEADBEEF').to respond_with_slack_message('Hi <@user>!')
    end
  end
  context 'it responds to direct name calling' do
    it 'with bot name' do
      expect(message: SlackRubyBot.config.user.to_s, channel: 'DEADBEEF').to respond_with_slack_message(SlackRubyBot::ABOUT)
    end
    it 'with bot name capitalized' do
      expect(message: SlackRubyBot.config.user.upcase.to_s, channel: 'DEADBEEF').to respond_with_slack_message(SlackRubyBot::ABOUT)
    end
    it 'with bot user id' do
      expect(message: "<@#{SlackRubyBot.config.user_id}>", channel: 'DEADBEEF').to respond_with_slack_message(SlackRubyBot::ABOUT)
    end
    it 'with bot user id and a colon' do
      expect(message: "<@#{SlackRubyBot.config.user_id}>:", channel: 'DEADBEEF').to respond_with_slack_message(SlackRubyBot::ABOUT)
    end
    it 'with bot user id and a colon and a space' do
      expect(message: "<@#{SlackRubyBot.config.user_id}>: ", channel: 'DEADBEEF').to respond_with_slack_message(SlackRubyBot::ABOUT)
    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/direct_messages_spec.rb
slack-ruby-bot-0.16.0 spec/slack-ruby-bot/commands/direct_messages_spec.rb
slack-ruby-bot-0.15.0 spec/slack-ruby-bot/commands/direct_messages_spec.rb
slack-ruby-bot-0.14.0 spec/slack-ruby-bot/commands/direct_messages_spec.rb
slack-ruby-bot-0.13.0 spec/slack-ruby-bot/commands/direct_messages_spec.rb