Users cannot change their own username after 3 days since registering. Site setting username_change_period allows you to change the number of days.

This commit is contained in:
Neil Lalonde
2013-08-12 14:54:52 -04:00
parent ffcf3f7e7d
commit b36c6d7b78
8 changed files with 61 additions and 4 deletions

View File

@ -521,8 +521,8 @@ describe UsersController do
lambda { xhr :put, :username, username: user.username }.should raise_error(ActionController::ParameterMissing)
end
it 'raises an error when you don\'t have permission to change the user' do
Guardian.any_instance.expects(:can_edit?).with(user).returns(false)
it 'raises an error when you don\'t have permission to change the username' do
Guardian.any_instance.expects(:can_edit_username?).with(user).returns(false)
xhr :put, :username, username: user.username, new_username: new_username
response.should be_forbidden
end