spec/postrank-uri_spec.rb in postrank-uri-1.0.4 vs spec/postrank-uri_spec.rb in postrank-uri-1.0.5
- old
+ new
@@ -115,11 +115,10 @@
end
end
context "clean" do
-
def c(uri)
PostRank::URI.clean(uri)
end
it "should unescape, c18n and normalize" do
@@ -139,10 +138,23 @@
it "should clean host specific parameters" do
YAML.load_file('spec/c18n_hosts.yml').each do |orig, clean|
c(orig).should == clean
end
end
+ end
+ context "hash" do
+ def h(uri)
+ PostRank::URI.hash(uri)
+ end
+
+ it "should compute MD5 hash of the normalized URI" do
+ hash = '021a1032b1ea631a7c33d1a0ccc562bf'
+
+ h('http://EverBurnign.Com/feed/post/1').should == hash
+ h('Everburnign.com/feed/post/1').should == hash
+ h('everburnign.com/feed/post/1').should == hash
+ end
end
context "extract" do
def e(text)
PostRank::URI.extract(text)