Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-26 17:14:41 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-12-26 17:14:41 +0300
commitdbfac0de066c4770a15d4e9a96dbc01edf9add3f (patch)
tree2491029249b09b770eee0c2d20c83bdf82b147fd /spec/migrations
parent645412b57f558d58418aad278c9a3bf421439e1c (diff)
Rename users with namespace ending with .git
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/remove_dot_git_from_usernames.rb29
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