Sha256: 9ac2afe39dbe272738704975cc3dc4e33448492b1b50fa7d9e5a77d1224b214b

Contents?: true

Size: 1022 Bytes

Versions: 2

Compression:

Stored size: 1022 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 { is_expected.to route_command('quack something') }
  it { is_expected.to route_command('ddg something') }

  it 'does neat ducky things' do
    mock('mock_result')
    send_command 'duck yo'
    expect(replies.last).to include('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('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('https://en.wikipedia.org/wiki/Go')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lita-onewheel-duckduckgo-0.1.0 spec/lita/handlers/onewheel_duckduckgo_spec.rb
lita-onewheel-duckduckgo-0.0.5 spec/lita/handlers/onewheel_duckduckgo_spec.rb