Sha256: 8f550e1692e406cd0884958863104b8fce5132e5df6308324ae822a5804e727b

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

require "spec_helper"

describe Lita::Handlers::Stocks, lita_handler: true do
  it { routes_command("stock GOOG").to(:stock_info) }
  it { doesnt_route_command("stock").to(:stock_info) }

  it "checks default stock" do
    send_command "stock GOOG"
    expect(replies.last).to include("Google Inc")
    expect(replies.last).to include("GOOG")
    expect(replies.last).to include("NASDAQ")
    expect(replies.last).to include("MktCap")
  end

  it "checks an invalid stock" do
    send_command "stock GOOGFAKE"
    expect(replies.last).to eq("Sorry, but there was a problem retrieving stock information.")
  end

  it "checks a stock without mktcap" do
    send_command "stock .DJI"
    expect(replies.last).to include("Dow Jones Industrial")
    expect(replies.last).to_not include("MktCap")
    expect(replies.last).to_not include("P/E")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-stocks-0.0.4 spec/lita/handlers/stocks_spec.rb