Sha256: 01892f9aca96e65a7512e376d84cccd9cfd1bc2daff4350d2823c827c5a4c32f

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
falcore-0.2.0 spec/functional/fetcher_spec.rb
falcore-0.1.1 spec/functional/fetcher_spec.rb
falcore-0.1.0 spec/functional/fetcher_spec.rb