Sha256: 483ac336dcb2b52d0b3cb29d1c1ff10ef60941de478e05ed68de009b3dc47c51

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 Bytes

Contents

require 'spec_helper'
# require 'onewheel-duckduckgo'

describe Lita::Handlers::OnewheelDuckDuckGo, lita_handler: true do

  before(:each) do
  end

  def mock(file)
    mock_result_json = File.open("spec/fixtures/#{file}.json").read
    allow(RestClient).to receive(:get).and_return( mock_result_json)
  end

  it { is_expected.to route_command('duck something') }

  it 'does neat ducky things' do
    mock('mock_result')
    send_command 'duck yo'
    expect(replies.last).to include('DuckDuckGo Result: DuckDuckGo is an Internet search engine that emphasizes')
  end

  it 'uses the url unless the abstract exists' do
    mock('mock_no_abstract')
    send_command 'duck yo'
    expect(replies.last).to include('DuckDuckGo Result: https://en.wikipedia.org/wiki/Duck_(disambiguation)')
  end

  it 'checks for go' do
    mock('mock_go')
    send_command 'duck go'
    expect(replies.last).to include('DuckDuckGo Result: https://en.wikipedia.org/wiki/Go')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lita-onewheel-duckduckgo-0.0.3 spec/lita/handlers/onewheel_duckduckgo_spec.rb
lita-onewheel-duckduckgo-0.0.2 spec/lita/handlers/onewheel_duckduckgo_spec.rb