* 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user