Sha256: 1e0f1ae3b2b9b7868bc27b703eb05fdbbe8c72020bb1e83bbdcaaf31da8a92aa

Contents?: true

Size: 638 Bytes

Versions: 8

Compression:

Stored size: 638 Bytes

Contents

require_relative '../spec_helper'

module Barometer
  describe Utils::Get do
    describe '.call' do
      it 'gets http content from a given address' do
        stub_request(:get, 'www.example.com?foo=bar').to_return(body: 'Hello World')

        response = Utils::Get.call('www.example.com', foo: :bar)
        expect( response.content ).to include('Hello World')
      end

      it 'raises Barometer::TimeoutError when it times out' do
        stub_request(:get, 'www.example.com').to_timeout

        expect {
          Utils::Get.call('www.example.com')
        }.to raise_error(Barometer::TimeoutError)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
barometer-0.9.7 spec/utils/get_spec.rb
barometer-0.9.6 spec/utils/get_spec.rb
barometer-0.9.5 spec/utils/get_spec.rb
barometer-0.9.4 spec/utils/get_spec.rb
barometer-0.9.3 spec/utils/get_spec.rb
barometer-0.9.2 spec/utils/get_spec.rb
barometer-0.9.1 spec/utils/get_spec.rb
barometer-0.9.0 spec/utils/get_spec.rb