Sha256: 191040cbb5d2eefa438f604baf8aa2ae944bb1e14ce5f0196927385f5b6fe28d

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

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

6 entries across 6 versions & 1 rubygems

Version Path
slack-ruby-bot-0.10.1 spec/slack-ruby-bot/commands/direct_messages_spec.rb
slack-ruby-bot-0.10.0 spec/slack-ruby-bot/commands/direct_messages_spec.rb
slack-ruby-bot-0.9.0 spec/slack-ruby-bot/commands/direct_messages_spec.rb
slack-ruby-bot-0.8.2 spec/slack-ruby-bot/commands/direct_messages_spec.rb
slack-ruby-bot-0.8.1 spec/slack-ruby-bot/commands/direct_messages_spec.rb
slack-ruby-bot-0.8.0 spec/slack-ruby-bot/commands/direct_messages_spec.rb