Sha256: bfe705ebd7ab7753362e3bf3c0bce06f80f092cf55a5583a175ee6dc36b89456

Contents?: true

Size: 731 Bytes

Versions: 10

Compression:

Stored size: 731 Bytes

Contents

require 'spec_helper'

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

10 entries across 10 versions & 1 rubygems

Version Path
slack-ruby-bot-0.10.1 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.10.0 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.9.0 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.8.2 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.8.1 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.8.0 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.7.0 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.6.2 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.6.1 spec/slack-ruby-bot/commands/operators_with_block_spec.rb
slack-ruby-bot-0.6.0 spec/slack-ruby-bot/commands/operators_with_block_spec.rb