Sha256: 6a7fd91d720d20838cc2587ad854b160f4f0b1dd995c747c46bb566d681f4e5a

Contents?: true

Size: 791 Bytes

Versions: 1

Compression:

Stored size: 791 Bytes

Contents

require "spec_helper"

describe Lita::Handlers::Doubler, lita_handler: true do
  describe 'routing' do 
    it {is_expected.to route('Lita double 2')}
    it {is_expected.to route('Lita double     22')}
    # allow mixed casing
    it {is_expected.to route('Lita doUBle 4')}
    # ignore numbers that don't look like integers
    it {is_expected.to_not route('Lita double two')}
    it {is_expected.to_not route('Lita double 1e4')}
  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.lasts).to eq('2 + 2 = 4')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-doubler-wanderingslc-0.1.0 spec/lita/handlers/doubler_spec.rb