spec/lita/handlers/onewheel_aqi_spec.rb in lita-onewheel-aqi-0.1.2 vs spec/lita/handlers/onewheel_aqi_spec.rb in lita-onewheel-aqi-0.2.0

- old
+ new

@@ -1,5 +1,34 @@ -require "spec_helper" +require 'spec_helper' describe Lita::Handlers::OnewheelAqi, lita_handler: true do it { is_expected.to route_command('aqi') } + + before do + mock = File.open('spec/fixtures/Output.json').read + allow(RestClient).to receive(:get) { mock } + + Geocoder.configure(lookup: :test) + + Geocoder::Lookup::Test.add_stub( + 'Portland, OR', [{ + 'formatted_address' => 'Portland, OR, USA', + 'geometry' => { + 'location' => { + 'lat' => 45.523452, + 'lng' => -122.676207, + 'address' => 'Portland, OR, USA', + 'state' => 'Oregon', + 'state_code' => 'OR', + 'country' => 'United States', + 'country_code' => 'US' + } + } + }] + ) + end + + it 'queries the aqi' do + send_command 'aqi' + expect(replies.last).to include("AQI for Portland, OR, USA, Observed: \u0003118\u0003 Unhealthy for Sensitive Groups at 2017-08-09 1100 hours.") + end end