Sha256: 9e21f8f097d55b7a82c3d652edf314943f00a4cc1c6a08386cb799b393d019fb

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 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') }
    it { is_expected.to route('Lita doUble 4') }

    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
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

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