* Continued work on improving post view templates

* Added statistics-based estimator for related tag calculator
* Fleshed out IpBan class based on changes to Danbooru 1.xx
This commit is contained in:
albert
2010-04-29 17:32:15 -04:00
parent 3666364469
commit 23656e3fa9
39 changed files with 816 additions and 86 deletions

View File

@@ -1,4 +1,16 @@
require File.dirname(__FILE__) + '/../test_helper'
class IpBanTest < ActiveSupport::TestCase
def test_count_by_ip_addr
comment = Factory.create(:comment)
counts = IpBan.count_by_ip_addr("comments", [comment.creator_id])
assert_equal([{"ip_addr" => "1.2.3.4", "count" => "1"}], counts)
end
def test_search
post = create_post()
comment = create_comment(post, :ip_addr => "1.2.3.4", :body => "aaa")
counts = IpBan.search([comment.user_id])
assert_equal([{"ip_addr" => "1.2.3.4", "count" => "1"}], counts["comments"])
end
end