spec/lita/handlers/onewheel_aqi_spec.rb in lita-onewheel-aqi-2.0.8 vs spec/lita/handlers/onewheel_aqi_spec.rb in lita-onewheel-aqi-2.0.9

- old
+ new

@@ -1,16 +1,19 @@ require 'spec_helper' +require 'timecop' describe Lita::Handlers::OnewheelAqi, lita_handler: true do it { is_expected.to route_command('aqi') } it { is_expected.to route_command('aqidetails') } it { is_expected.to route_command('aqideets') } before do mock = File.open('spec/fixtures/Output.json').read allow(RestClient).to receive(:get) { mock } + Timecop.freeze Time.local(2017, 8, 11, 16, 0, 0) + Geocoder.configure(lookup: :test) Geocoder::Lookup::Test.add_stub( 'Portland, OR', [{ 'formatted_address' => 'Portland, OR, USA', @@ -29,13 +32,13 @@ ) end it 'queries the aqi' do send_command 'aqi' - expect(replies.last).to include("AQI for Portland, OR, USA, ⚠️ 08Moderate ⚠️ pm25: 0876 pm10: 0340 updated 15:00 8/11/17 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)") + expect(replies.last).to include("AQI for Portland, OR, USA, ⚠️ 08Moderate ⚠️ pm25: 0876 pm10: 0340 updated 0860 minutes ago. 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)") end it 'queries the aqideets' do send_command 'aqideets' - expect(replies.last).to eq("AQI for Portland, OR, USA, ⚠️ \u000308Moderate\u0003 ⚠️ humidity: 11% pressure: 1014mb pm10: \u00030340\u0003 pm25: \u00030876\u0003 temp: 34.65C \u000314(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)\u0003") + expect(replies.last).to eq("AQI for Portland, OR, USA, ⚠️ 08Moderate ⚠️ humidity: 11% pressure: 1014mb pm10: 0340 pm25: 0876 temp: 34.65C updated 0860 minutes ago. 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)") end end