Add back test to ensure user can't edit name after `SiteSetting.username_change_period`.

This commit is contained in:
Guo Xiang Tan 2017-07-24 20:46:44 +09:00
parent ed5d322196
commit 54b508dda3
1 changed files with 5 additions and 3 deletions

View File

@ -936,11 +936,13 @@ describe UsersController do
expect(user.reload.username).to eq(new_username) expect(user.reload.username).to eq(new_username)
end end
skip 'should fail if the user is old', 'ensure_can_edit_username! is not throwing' do it 'should fail if the user is old' do
# Older than the change period and >1 post # Older than the change period and >1 post
user.created_at = Time.now - (SiteSetting.username_change_period + 1).days user.created_at = Time.now - (SiteSetting.username_change_period + 1).days
user.stubs(:post_count).returns(200) PostCreator.new(user,
expect(Guardian.new(user).can_edit_username?(user)).to eq(false) title: 'This is a test topic',
raw: 'This is a test this is a test'
).create
xhr :put, :username, username: user.username, new_username: new_username xhr :put, :username, username: user.username, new_username: new_username