Sha256: ac8e34b7a7723eb9f98bd5e9d3fdeb3c701a4ae06e31c92061dd91d896d9c543

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

#encoding: utf-8
#
require 'mida/datatype'
require 'yaml'

describe Mida::DataType::URL do

  it '#parse should raise an exception if a bad url passed' do
    test = lambda {Mida::DataType::URL.parse('example.com')}
    test.should raise_error(ArgumentError)
  end

  it '#parse should raise an exception if value is empty' do
    test = lambda {Mida::DataType::URL.parse('')}
    test.should raise_error(ArgumentError)
  end

  it '#parse should accept a valid url' do
    url_text = 'http://example.com/test/'
    url = Mida::DataType::URL.parse(url_text)
    url.to_s.should == url_text
  end


  it '#parse should accept a valid url with special characters' do
    url_text = 'http://example.com/übergangslösung'
    url = Mida::DataType::URL.parse(url_text)
    url.to_s.should == ::Addressable::URI.encode(url_text)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mida-0.3.8 spec/datatype/url_spec.rb
mida-0.3.7 spec/datatype/url_spec.rb