Sha256: 46aaa007ceb59a3e43f4ec2602425b3cb0d4d36735d97265aea4bd5aaf1e40f4

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 Bytes

Contents

require 'spec_helper'

describe UrlRegexp::Scheme do
  subject { described_class.new }

  describe '#to_regexp_s' do
    context 'single scheme' do
      it 'returns regexp string' do
        subject.append('http')
        expect(subject.to_regexp_s).to eq 'http://'
      end
    end
    context 'multiple schemes' do
      it 'returns regexp string' do
        subject.append('http')
        subject.append('https')
        subject.append('ftp')
        expect(subject.to_regexp_s).to eq '(http|https|ftp)://'
      end
    end
    context 'http and https' do
      it 'returns regexp string' do
        subject.append('http')
        subject.append('https')
        expect(subject.to_regexp_s).to eq 'https?://'
      end
    end
    context 'no scheme' do
      it 'returns regexp string' do
        expect(subject.to_regexp_s).to eq ''
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
url_regexp-0.1.4 spec/url_regexp/scheme_spec.rb