spec/earl/url_spec.rb in earl-0.1.0 vs spec/earl/url_spec.rb in earl-0.2.0

- old
+ new

@@ -31,6 +31,19 @@ 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 + + it 'should be able to change the host' do + url = Earl::URL.new 'www.foo.com' + url.host = 'foo.edu' + url.to_s.should eq( 'www.foo.edu' ) + end + it 'should not be able to add a host' do + expect { url = Earl::URL.new 'http://' }.to raise_error( Earl::InvalidURLError ) + end + it 'should not be able to remove a host' do + url = Earl::URL.new 'http://foo.com' + expect { url.host = nil }.to raise_error( Earl::InvalidURLError ) + end end