users with no negative feedback can now change their names

This commit is contained in:
albert
2011-12-20 16:18:35 -05:00
parent 30fb0b660c
commit 5e3b243b67
6 changed files with 48 additions and 6 deletions

View File

@@ -31,6 +31,22 @@ class UserTest < ActiveSupport::TestCase
assert_equal(User::Levels::MEMBER, @user.level)
end
end
context "who has negeative feedback and is trying to change their name" do
setup do
@mod = Factory.create(:moderator_user)
CurrentUser.scoped(@mod, "127.0.0.1") do
Factory.create(:user_feedback, :user => @user, :category => "negative")
end
end
should "not validate" do
@user.reload
@user.update_attributes(:name => "fanfarlo")
assert_equal(["You can not change your name if you have any negative feedback"], @user.errors.full_messages)
end
end
should "not validate if the originating ip address is banned" do
Factory.create(:ip_ban)