spec/unit/contextio/api_spec.rb in contextio-1.8.1 vs spec/unit/contextio/api_spec.rb in contextio-2.0.0

- old
+ new

@@ -117,9 +117,25 @@ end describe "#request" do subject { ContextIO::API.new(nil, nil).request(:get, 'test') } + context "with a timeout response" do + before do + WebMock.stub_request( + :get, + 'https://api.context.io/2.0/test' + ).to_timeout.then.to_return( + status: 200, + body: JSON.dump('yep' => 'noap'), + ) + end + + it "parses the JSON response" do + expect { ContextIO::API.new(nil, nil).request(:get, 'test') }.to raise_error(Faraday::Error::TimeoutError) + end + end + context "with a good response" do before do WebMock.stub_request( :get, 'https://api.context.io/2.0/test'