Sha256: 890b4edb9370c60b0ab4ddd4420c235239c2dc1042450076adf7d9eedc3b7a91

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

require 'spec_helper'

describe Lita::Handlers::OnewheelElectionCnn, lita_handler: true do
  it { is_expected.to route_command('election') }

  it 'shows the current election results' do
    mock = File.open('spec/fixtures/election.json').read
    allow(RestClient).to receive(:get) { mock }
    send_command 'election'
    expect(replies[0]).to eq("Hillary Clinton: 0.0%, 0% of precincts reporting.")
    expect(replies[1]).to eq("Donald Trump: 0.0%, 0% of precincts reporting.")
  end

  it 'shows a winner' do
    mock = File.open('spec/fixtures/winner.json').read
    allow(RestClient).to receive(:get) { mock }
    send_command 'election'
    expect(replies[0]).to eq("Hillary Clinton: WINNER! 0.0%, 0% of precincts reporting.")
    expect(replies[1]).to eq("Donald Trump: 0.0%, 0% of precincts reporting.")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-onewheel-election-cnn-0.0.0 spec/lita/handlers/onewheel_election_cnn_spec.rb