Add history view test

This commit is contained in:
bootstraponline
2012-11-14 21:03:24 -07:00
parent 9cf469b035
commit 3d21ed362e
2 changed files with 31 additions and 2 deletions
+6 -2
View File
@@ -33,9 +33,9 @@ module Precious
(r & 2147483648) == 0 ? r : r - 4294967296
end
def _identicon_code(blob)
def string_to_code string
# sha bytes
b = [Digest::SHA1.hexdigest(blob + @request.host)[0,20]].pack('H*').bytes.to_a
b = [Digest::SHA1.hexdigest(string)[0,20]].pack('H*').bytes.to_a
# Thanks donpark's IdenticonUtil.java for this.
# Match the following Java code
# ((b[0] & 0xFF) << 24) | ((b[1] & 0xFF) << 16) |
@@ -47,6 +47,10 @@ module Precious
b[3] & 0xFF
end
def _identicon_code(blob)
string_to_code blob + @request.host
end
def use_identicon
@page.wiki.user_icons == 'identicon'
end