add 24 hour window for repeating an ip addr for account creation (ref #3301)

This commit is contained in:
r888888888
2017-09-15 15:13:01 -07:00
parent 908770c4b0
commit 4c565b443e
2 changed files with 19 additions and 9 deletions

View File

@@ -298,6 +298,20 @@ class UserTest < ActiveSupport::TestCase
end
end
context "that might be a sock puppet" do
setup do
@user = FactoryGirl.create(:user, last_ip_addr: "127.0.0.2")
end
should "not validate" do
CurrentUser.scoped(nil, "127.0.0.2") do
@user = FactoryGirl.build(:user)
@user.save
assert_equal(["Last ip addr was used recently for another account and cannot be reused for another day"], @user.errors.full_messages)
end
end
end
context "when searched by name" do
should "match wildcards" do
user1 = FactoryGirl.create(:user, :name => "foo")