diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-12-26 16:14:41 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-12-26 16:14:41 +0200 |
commit | dbfac0de066c4770a15d4e9a96dbc01edf9add3f (patch) | |
tree | 2491029249b09b770eee0c2d20c83bdf82b147fd /spec/migrations | |
parent | 645412b57f558d58418aad278c9a3bf421439e1c (diff) | |
download | gitlab-ce-dbfac0de066c4770a15d4e9a96dbc01edf9add3f.tar.gz |
Rename users with namespace ending with .gitdz-rename-invalid-users
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/remove_dot_git_from_usernames.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/migrations/remove_dot_git_from_usernames.rb b/spec/migrations/remove_dot_git_from_usernames.rb new file mode 100644 index 00000000000..1b1d2adc463 --- /dev/null +++ b/spec/migrations/remove_dot_git_from_usernames.rb @@ -0,0 +1,29 @@ +# encoding: utf-8 + +require 'spec_helper' +require Rails.root.join('db', 'migrate', '20161226122833_remove_dot_git_from_usernames.rb') + +describe RemoveDotGitFromUsernames do + let(:user) { create(:user) } + + describe '#up' do + let(:migration) { described_class.new } + + before do + namespace = user.namespace + namespace.path = 'test.git' + namespace.save!(validate: false) + + user.username = 'test.git' + user.save!(validate: false) + end + + it 'renames user with .git in username' do + migration.up + + expect(user.reload.username).to eq('test_git') + expect(user.namespace.reload.path).to eq('test_git') + expect(user.namespace.route.path).to eq('test_git') + end + end +end |