Sha256: 04e0d5f1a5babac8c9e49308635f1c4beefb3dcd3824fce2c127dfa64f4c12e0

Contents?: true

Size: 739 Bytes

Versions: 5

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

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

      operator '+', '-' do |client, data, match|
        client.say(channel: data.channel, text: "#{match[:operator]}: #{match[:expression]}")
      end
    end
  end
  def app
    SlackRubyBot::App.new
  end
  it 'supports operator blocks' do
    expect(message: '=2+2').to respond_with_slack_message('=: 2+2')
    expect(message: '+2+2').to respond_with_slack_message('+: 2+2')
    expect(message: '-2+2').to respond_with_slack_message('-: 2+2')
  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/operators_with_block_spec.rb
slack-ruby-bot-0.16.0 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.15.0 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.14.0 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.13.0 spec/slack-ruby-bot/commands/operators_with_block_spec.rb