Sha256: 1461e2621b3fc42f4d630e798594685911d2fc5a255a983858809b32d71ed45a

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

require 'spec_helper'

describe Request::Protocol, '.get' do
  let(:object) { described_class }

  subject { object.get(input) }

  context 'with "http"' do
    let(:input) { 'http' }
    it { should eql(Request::Protocol::HTTP) }
  end

  context 'with "https"' do
    let(:input) { 'https' }
    it { should eql(Request::Protocol::HTTPS) }
  end

  context 'with "ftp"' do
    let(:input) { 'ftp' }
    it 'should raise error' do
      # jruby has different message format
      expectation =
        begin
          {}.fetch('ftp')
        rescue KeyError => error
          error
        end
      expect { subject }.to raise_error(KeyError, expectation.message)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
request-0.0.6 spec/unit/request/protocol/class_methods/get_spec.rb