Sha256: d61bbd18399867b989791074fc3b4f3ae71be12f3e956392a8574b483809e64b

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

require 'spec_helper'
require 'calagator/url_prefixer'

module Calagator
  describe UrlPrefixer do
    it 'adds an http prefix to urls missing it' do
      url = UrlPrefixer.prefix('google.com')
      url.should == 'http://google.com'
    end

    it 'leaves urls with an existing scheme alone' do
      url = UrlPrefixer.prefix('https://google.com')
      url.should == 'https://google.com'
    end

    it 'leaves blank urls alone' do
      url = UrlPrefixer.prefix(' ')
      url.should == ' '
    end

    it 'leaves nil urls alone' do
      url = UrlPrefixer.prefix(nil)
      url.should.nil?
    end

    it 'avoids whitespace inside url' do
      url = UrlPrefixer.prefix(' google.com ')
      url.should == 'http://google.com '
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calagator-1.1.0 spec/lib/calagator/url_prefixer_spec.rb