users with no negative feedback can now change their names
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user