Fix ip addr search tests.

This commit is contained in:
evazion
2017-01-12 07:43:59 +00:00
parent 26c193dfb3
commit cf046eecbf
2 changed files with 4 additions and 4 deletions

View File

@@ -58,7 +58,7 @@ module Moderator
add_row(sums, PostAppeal.where(creator: users).where.not(creator_ip_addr: nil).group(:creator_ip_addr).count)
add_row(sums, PostFlag.where(creator: users).group(:creator_ip_addr).count)
add_row(sums, Upload.where(uploader: users).group(:uploader_ip_addr).count)
add_row(sums, User.where(id: users).group(:last_ip_addr).count)
add_row(sums, User.where(id: users).where.not(last_ip_addr: nil).group(:last_ip_addr).count)
sums
end

View File

@@ -19,17 +19,17 @@ module Moderator
should "find by ip addr" do
@search = IpAddrSearch.new(:ip_addr => "127.0.0.1")
assert_equal({@user.id.to_s => 2}, @search.execute)
assert_equal({@user => 2}, @search.execute)
end
should "find by user id" do
@search = IpAddrSearch.new(:user_id => @user.id.to_s)
assert_equal({"127.0.0.1" => 2}, @search.execute)
assert_equal({IPAddr.new("127.0.0.1") => 2}, @search.execute)
end
should "find by user name" do
@search = IpAddrSearch.new(:user_name => @user.name)
assert_equal({"127.0.0.1" => 2}, @search.execute)
assert_equal({IPAddr.new("127.0.0.1") => 2}, @search.execute)
end
end
end