spec/lita/handlers/down_spec.rb in lita-down-1.0.0 vs spec/lita/handlers/down_spec.rb in lita-down-1.0.1

- old
+ new

@@ -1,34 +1,38 @@ -require "spec_helper" +require 'spec_helper' describe Lita::Handlers::Down, lita_handler: true do - it { is_expected.to route_command("Is example.com down?").to(:down) } - it { is_expected.to route_command("is example.com down?").to(:down) } + it { is_expected.to route_command('Is example.com down?').to(:down) } + it { is_expected.to route_command('is example.com down?').to(:down) } - describe "Checking availability of a site" do - context "when Faraday returns any object" do + describe 'Checking availability of a site' do + context 'when Faraday returns any object' do before do - faraday_double = double("faraday") + faraday_double = double('faraday') expect(Faraday::Connection).to receive(:new).and_return(faraday_double) expect(faraday_double).to receive(:head).and_return(Object.new) end - it "responds that the site is up" do - send_message("Is example.com down?") + it 'responds that the site is up' do + send_message('Is example.com down?') expect(replies.last).to eq("It's just you. example.com is up.") end end - context "when Faraday raises" do + context 'when Faraday raises' do + let(:expected_message) do + "It's not just you! example.com looks down from here." + end + before do - faraday_double = double("faraday") + faraday_double = double('faraday') expect(Faraday::Connection).to receive(:new).and_return(faraday_double) expect(faraday_double).to receive(:head).and_raise end - it "responds that the site is down" do - send_message("Is example.com down?") - expect(replies.last).to eq("It's not just you! example.com looks down from here.") + it 'responds that the site is down' do + send_message('Is example.com down?') + expect(replies.last).to eq(expected_message) end end end end