require 'spec_helper' describe Earl::URL do it 'should be able to change the scheme' do url = Earl::URL.new 'http://foo.com' url.scheme = 'https' url.to_s.should eq( 'https://foo.com' ) end it 'should be able to add a scheme' do url = Earl::URL.new 'foo.com' url.scheme = 'http' url.to_s.should eq( 'http://foo.com' ) end it 'should be able to remove the scheme' do url = Earl::URL.new 'http://foo.com' url.scheme = nil url.to_s.should eq( 'foo.com' ) end it 'should be able to change the subdomain' do url = Earl::URL.new 'foo.bar.com' url.subdomain = 'baz' url.to_s.should eq( 'baz.bar.com' ) end it 'should be able to add a subdomain' do url = Earl::URL.new 'foo.com' url.subdomain = 'bar' url.to_s.should eq( 'bar.foo.com' ) end it 'should be able to remove the subdomain' do url = Earl::URL.new 'foo.bar.com' url.subdomain = nil url.to_s.should eq( 'bar.com' ) end end