Files
danbooru/test/unit/ip_ban_test.rb
albert 23656e3fa9 * 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
2010-04-29 17:32:15 -04:00

17 lines
562 B
Ruby

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