require 'spec_helper' module Falcore describe Fetcher, :integration do describe '.get' do context 'when given something that is not a URL' do it 'raises a RuntimeError' do expect { Fetcher.get('/path/to/file') }.to raise_error(RuntimeError) end end context 'when given something that is a 404' do it 'raises a RuntimeError' do expect { Fetcher.get('http://jenkins.local/foo/bar') }.to raise_error(RuntimeError) end end context 'when given something that would raise a SocketError' do it 'raises a RuntimeError' do expect { Fetcher.get('http://jenkins.local:5000/foo/bar') }.to raise_error(RuntimeError) end end context 'when given invalid JSON' do it 'raises RuntimeError' do expect { Fetcher.get('http://jenkins.local/bad_json') }.to raise_error(RuntimeError) end end end end end