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
path: root/spec
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-05-19 00:31:03 +0300
committerBob Van Landuyt <bob@gitlab.com>2017-05-19 08:21:35 +0300
commitdf5c3f364a3d415e35a2da462f044b08b854285b (patch)
treebbbd98f2b9690576cc8e861deb00db25c37e92ff /spec
parente4eec191565a053f687911d80865ad43241453f8 (diff)
Rename users that had their namespace renamed
Diffstat (limited to 'spec')
-rw-r--r--spec/migrations/rename_users_with_renamed_namespace_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/migrations/rename_users_with_renamed_namespace_spec.rb b/spec/migrations/rename_users_with_renamed_namespace_spec.rb
new file mode 100644
index 00000000000..aefa539094f
--- /dev/null
+++ b/spec/migrations/rename_users_with_renamed_namespace_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+require Rails.root.join('db', 'post_migrate', '20170518200835_rename_users_with_renamed_namespace.rb')
+
+describe RenameUsersWithRenamedNamespace, truncate: true do
+ it 'renames a user that had his namespace renamed to the namespace path' do
+ other_user = create(:user, username: 'kodingu')
+
+ user = create(:user, username: "Users0")
+ user.update_attribute(:username, 'Users')
+ user1 = create(:user, username: "import0")
+ user1.update_attribute(:username, 'import')
+
+ described_class.new.up
+
+ expect(user.reload.username).to eq('Users0')
+ expect(user1.reload.username).to eq('import0')
+ expect(other_user.reload.username).to eq('kodingu')
+ end
+end