Sha256: 200a9ab41b5f11e4c2b2c64d85e4e62a1b087a6ded71f32828581ba40367ff9e

Contents?: true

Size: 799 Bytes

Versions: 4

Compression:

Stored size: 799 Bytes

Contents

require "spec_helper"

describe Lita::Handlers::Doubler, lita_handler: true do
  describe 'routing' do
    # allow whitespace
    it { is_expected.to route('Lita double 2') }
    it { is_expected.to route('Lita double    22') }
    # ignore CaSe
    it { is_expected.to route('Lita DouBLe 4') }

    # ignore text and mixed strings
    it { is_expected.to_not route('Lita double four') }
    it { is_expected.to_not route('Lita double 1d4 ') }
  end

  describe ':double_number' do
    let(:n) { rand(1..100) }

    it 'returns double the input' do
      actual = subject.double_number n
      expected = n * 2

      expect(actual).to eq(expected)
    end

    it 'doubles numbers when asked to' do
      send_message 'Lita double 2'
      expect(replies.last).to eq('2 + 2 = 4')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lita-doubler-lcpp-0.1.3 spec/lita/handlers/doubler_spec.rb
lita-doubler-lcpp-0.1.2 spec/lita/handlers/doubler_spec.rb
lita-doubler-lcpp-0.1.1 spec/lita/handlers/doubler_spec.rb
lita-doubler-lcpp-0.1.0 spec/lita/handlers/doubler_spec.rb