diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-05-12 17:10:05 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-05-12 17:46:16 +0200 |
commit | 3760a7c230512fef8643bbd078e59ad20787d591 (patch) | |
tree | bf212e8a06a8c66c4e6e2d5712bb8e66a2e8446f /spec/lib/gitlab/database/rename_reserved_paths_migration | |
parent | 61f811e61d3782784f94d9f8ff36d62deb69e8fa (diff) | |
download | gitlab-ce-3760a7c230512fef8643bbd078e59ad20787d591.tar.gz |
Only rename namespaces and projects with an invalid path
For exact matches, not namespaces that end with an invalid path
Diffstat (limited to 'spec/lib/gitlab/database/rename_reserved_paths_migration')
-rw-r--r-- | spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb index a25c5da488a..ec444942804 100644 --- a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb +++ b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb @@ -23,6 +23,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do found_ids = subject.namespaces_for_paths(type: :child). map(&:id) + expect(found_ids).to contain_exactly(child.id) end end @@ -39,6 +40,22 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do found_ids = subject.namespaces_for_paths(type: :child). map(&:id) + + expect(found_ids).to contain_exactly(namespace.id) + end + + it 'has no namespaces that look the same' do + _root_namespace = create(:namespace, path: 'THE-path') + _similar_path = create(:namespace, + path: 'not-really-the-path', + parent: create(:namespace)) + namespace = create(:namespace, + path: 'the-path', + parent: create(:namespace)) + + found_ids = subject.namespaces_for_paths(type: :child). + map(&:id) + expect(found_ids).to contain_exactly(namespace.id) end end @@ -53,6 +70,20 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do found_ids = subject.namespaces_for_paths(type: :top_level). map(&:id) + + expect(found_ids).to contain_exactly(root_namespace.id) + end + + it 'has no namespaces that just look the same' do + root_namespace = create(:namespace, path: 'the-path') + _similar_path = create(:namespace, path: 'not-really-the-path') + _child_namespace = create(:namespace, + path: 'the-path', + parent: create(:namespace)) + + found_ids = subject.namespaces_for_paths(type: :top_level). + map(&:id) + expect(found_ids).to contain_exactly(root_namespace.id) end end |