Sha256: 9aec527f9474c3dd5a523feb0810d1a7a981e03f5c1f43f8764909e85a67565b

Contents?: true

Size: 963 Bytes

Versions: 4

Compression:

Stored size: 963 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


  it "ensures proper encoding" do
    send_command "stock T"
    expect(replies.last).to include("AT&T")
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lita-stocks-0.0.7 spec/lita/handlers/stocks_spec.rb
lita-stocks-0.0.6.2 spec/lita/handlers/stocks_spec.rb
lita-stocks-0.0.6.1 spec/lita/handlers/stocks_spec.rb
lita-stocks-0.0.5 spec/lita/handlers/stocks_spec.rb