Sha256: f84f474ad3820028233b5b66105060f38d4f0a678deeeb0ad080c41bf7cef51a

Contents?: true

Size: 904 Bytes

Versions: 6

Compression:

Stored size: 904 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)
        expect { send_request('') }.to raise_error(ArgumentError)
      end

    end

    describe 'invalid URL' do

      it 'raises error' do
        expect { send_request('asd123.rewqw') }.to raise_error(ArgumentError)
      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

6 entries across 6 versions & 1 rubygems

Version Path
dagger-1.7.0 spec/arguments_spec.rb
dagger-1.6.2 spec/arguments_spec.rb
dagger-1.6.1 spec/arguments_spec.rb
dagger-1.5.1 spec/arguments_spec.rb
dagger-1.4.1 spec/arguments_spec.rb
dagger-1.4.0 spec/arguments_spec.rb