Sha256: b21147c40d3b5d4ba6dc74b4f6a1b47414af2ac2219a00176a0158c0f9d6f293

Contents?: true

Size: 884 Bytes

Versions: 5

Compression:

Stored size: 884 Bytes

Contents

# frozen_string_literal: true

describe SlackRubyBot::Commands do
  let! :command do
    Class.new(SlackRubyBot::Commands::Base) do
      command 'sayhi' do |client, data, match|
        client.say(channel: data.channel, text: "#{match[:command]}: #{match[:expression]}")
      end

      command 'one', 'two' do |client, data, match|
        client.say(channel: data.channel, text: "#{match[:command]}: #{match[:expression]}")
      end
    end
  end
  def app
    SlackRubyBot::App.new
  end
  it 'supports multiple commands' do
    expect(message: "#{SlackRubyBot.config.user} sayhi arg1 arg2").to respond_with_slack_message('sayhi: arg1 arg2')
    expect(message: "#{SlackRubyBot.config.user} one arg1 arg2").to respond_with_slack_message('one: arg1 arg2')
    expect(message: "#{SlackRubyBot.config.user} two arg1 arg2").to respond_with_slack_message('two: arg1 arg2')
  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/commands_with_block_spec.rb
slack-ruby-bot-0.16.0 spec/slack-ruby-bot/commands/commands_with_block_spec.rb
slack-ruby-bot-0.15.0 spec/slack-ruby-bot/commands/commands_with_block_spec.rb
slack-ruby-bot-0.14.0 spec/slack-ruby-bot/commands/commands_with_block_spec.rb
slack-ruby-bot-0.13.0 spec/slack-ruby-bot/commands/commands_with_block_spec.rb