Sha256: ee7d8c3202211399e0fd582709351fea07839560c21c6e7ecdfe4d63c7b421cb

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

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 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

1 entries across 1 versions & 1 rubygems

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