Sha256: 965f7604165149b706edadc378a3c4457b79a7baa648bc704e34b09621e089f2

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

describe RSpec do
  let! :command do
    Class.new(SlackRubyBot::Commands::Base) do
      command 'types on the correct channel' do |client, data, _match|
        client.typing(channel: data.channel)
      end
      command 'types on another channel' do |client, _data, _match|
        client.typing(channel: 'another')
      end
    end
  end

  def app
    SlackRubyBot::App.new
  end
  it 'types on any channel' do
    expect(message: "#{SlackRubyBot.config.user} types on the correct channel", channel: 'channel')
      .to start_typing
  end
  it 'types on another channel' do
    expect(message: "#{SlackRubyBot.config.user} types on another channel", channel: 'channel')
      .to start_typing(channel: 'another')
  end
  it 'types an invalid channel' do
    expect(message: "#{SlackRubyBot.config.user} types on another channel", channel: 'channel')
      .to_not start_typing(channel: 'invalid')
  end
  it 'correctly reports error' do
    expect do
      expect(message: "#{SlackRubyBot.config.user} types on another channel", channel: 'channel')
        .to start_typing(channel: 'invalid')
    end.to raise_error RSpec::Expectations::ExpectationNotMetError, "expected to receive typing with: {:channel=>\"invalid\"} once,\n received:{:channel=>\"another\"}"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slack-ruby-bot-0.16.1 spec/slack-ruby-bot/rspec/start_typing_spec.rb
slack-ruby-bot-0.16.0 spec/slack-ruby-bot/rspec/start_typing_spec.rb
slack-ruby-bot-0.15.0 spec/slack-ruby-bot/rspec/start_typing_spec.rb
slack-ruby-bot-0.14.0 spec/slack-ruby-bot/rspec/start_typing_spec.rb
slack-ruby-bot-0.13.0 spec/slack-ruby-bot/rspec/start_typing_spec.rb