spec/postrank-uri_spec.rb in postrank-uri-1.0.13 vs spec/postrank-uri_spec.rb in postrank-uri-1.0.14

- old
+ new

@@ -241,10 +241,15 @@ u = e('abc.com abc.co') u.should include('http://abc.com/') u.should include('http://abc.co/') end + it "should pickup urls inside tags" do + u = e("<a href='http://bit.ly/3fds3'>abc.com</a>") + u.should include('http://abc.com/') + end + context "multibyte characters" do it "should stop extracting URLs at the full-width CJK space character" do e("http://www.youtube.com/watch?v=w_j4Lda25jA  とんかつ定食").should == ["http://www.youtube.com/watch?v=w_j4Lda25jA"] end end @@ -296,17 +301,24 @@ "ftp://www.example.com/2011/04/01/blah" => 'example.com', "http://com" => nil, "http://alex.pages.examplecom" => nil, "example" => nil, "http://127.0.0.1" => nil, - "localhost" => nil + "localhost" => nil, + "hello-there.com/you" => "hello-there.com" } url_list.each_pair do |url, expected_result| it "should extract #{expected_result.inspect} from #{url}" do u = PostRank::URI.clean(url, :raw => true) u.domain.should == expected_result end end + end + end + + context "parse" do + it 'should not fail on large host-part look-alikes' do + PostRank::URI.parse('a'*64+'.ca').host.should == nil end end end