Sha256: 68b54df01313581b0f8b2a50dbbcd61de58728927c0682f9eb9df263a3ac4a88

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

require './lib/dagger'

require 'rspec/mocks'
require 'rspec/expectations'

describe 'arguments' do

  describe 'URL' do

    def send_request(url)
      Dagger.get(url)
    end

    describe 'empty url' do

      it 'raises error' do
        expect { send_request('') }.to raise_error(URI::InvalidURIError)
      end

    end

    describe 'invalid URL' do

      it 'raises error' do
        expect { send_request('asd123.rewqw') }.to raise_error(SocketError)
      end

    end

    describe 'nonexisting host' do

      it 'raises error' do
        expect { send_request('http://www.foobar1234567890foobar.com/hello') }.to raise_error(SocketError)
      end

    end

    describe 'valid host' do

      it 'works' do
        expect(send_request('http://www.google.com')).to be_a(Net::HTTPResponse)
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dagger-0.6.1 test/arguments_spec.rb