Sha256: 02fdd9deca47b647c5aa5b6068672f233d2b2a1566f1a92f69f277dab5c79ca7

Contents?: true

Size: 708 Bytes

Versions: 8

Compression:

Stored size: 708 Bytes

Contents

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

8 entries across 8 versions & 1 rubygems

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