Sha256: 0d81876800d6dec990ee5b605d9fe35299fedd2c8f212643c3c5dda9c74a5336

Contents?: true

Size: 807 Bytes

Versions: 8

Compression:

Stored size: 807 Bytes

Contents

describe SlackRubyBot::Commands do
  let! :command do
    Class.new(SlackRubyBot::Commands::Base) do
      command 'set' do |client, data, match|
        if match['expression']
          k, v = match['expression'].split(/\W+/, 2)
          client.say(channel: data.channel, text: "#{match[:command]}: #{k}=#{v}")
        else
          client.say(channel: data.channel, text: (match[:command]).to_s)
        end
      end
    end
  end
  def app
    SlackRubyBot::App.new
  end
  it 'parses expression' do
    expect(message: "#{SlackRubyBot.config.user} set").to respond_with_slack_message('set')
    expect(message: "#{SlackRubyBot.config.user} set x").to respond_with_slack_message('set: x=')
    expect(message: "#{SlackRubyBot.config.user} set x y").to respond_with_slack_message('set: x=y')
  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/commands_with_expression_spec.rb
slack-ruby-bot-0.11.2 spec/slack-ruby-bot/commands/commands_with_expression_spec.rb
slack-ruby-bot-0.11.1 spec/slack-ruby-bot/commands/commands_with_expression_spec.rb
slack-ruby-bot-0.11.0 spec/slack-ruby-bot/commands/commands_with_expression_spec.rb
slack-ruby-bot-0.10.5 spec/slack-ruby-bot/commands/commands_with_expression_spec.rb
slack-ruby-bot-0.10.4 spec/slack-ruby-bot/commands/commands_with_expression_spec.rb
slack-ruby-bot-0.10.3 spec/slack-ruby-bot/commands/commands_with_expression_spec.rb
slack-ruby-bot-0.10.2 spec/slack-ruby-bot/commands/commands_with_expression_spec.rb