Fix ip addr search tests.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user