* Missing files
* Work on post exploration code by traversing dates
This commit is contained in:
@@ -2,8 +2,8 @@ require_relative '../test_helper'
|
||||
|
||||
class IpBanTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
user = Factory.create(:user)
|
||||
CurrentUser.user = user
|
||||
@user = Factory.create(:user)
|
||||
CurrentUser.user = @user
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
MEMCACHE.flush_all
|
||||
end
|
||||
@@ -20,8 +20,10 @@ class IpBanTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "be able to count any updates from a user, groupiny by IP address" do
|
||||
comment = Factory.create(:comment, :ip_addr => "1.2.3.4", :body => "aaa")
|
||||
counts = IpBan.search([comment.creator_id])
|
||||
assert_equal([{"ip_addr" => "1.2.3.4", "count" => "1"}], counts["comments"])
|
||||
CurrentUser.scoped(@user, "1.2.3.4") do
|
||||
comment = Factory.create(:comment, :body => "aaa")
|
||||
counts = IpBan.search([comment.creator_id])
|
||||
assert_equal([{"ip_addr" => "1.2.3.4", "count" => "1"}], counts["comments"])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user