diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-09 03:48:24 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-09 03:48:24 +0300 |
commit | e8cced80777d75eab98a1ce81742d860e60a6e15 (patch) | |
tree | 0e232ce7c22787697e2cafb9d06d70eb1b75e340 /spec/lib/gitlab | |
parent | 78f7c3c8a2ac9f72b54e8e76005ef8810d1a068a (diff) |
Fix failing importer test case on MySQL due to missing trailing slash in root path
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/bare_repository_import/importer_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/bare_repository_import/repository_spec.rb | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/spec/lib/gitlab/bare_repository_import/importer_spec.rb b/spec/lib/gitlab/bare_repository_import/importer_spec.rb index dafec2b0033..52dbfeb2999 100644 --- a/spec/lib/gitlab/bare_repository_import/importer_spec.rb +++ b/spec/lib/gitlab/bare_repository_import/importer_spec.rb @@ -134,8 +134,12 @@ describe Gitlab::BareRepositoryImport::Importer, repository: true do end it 'moves an existing project to the correct path' do + # This is a quick way to get a valid repository instead of copying an existing one project = create(:project, :repository) original_commit_count = project.repository.commit_count + # We need to destroy the model but keep the repository so that the + # importer will attempt to load the repository + project.destroy bare_repo = Gitlab::BareRepositoryImport::Repository.new(project.repository_storage_path, project.repository.path) gitlab_importer = described_class.new(admin, bare_repo) diff --git a/spec/lib/gitlab/bare_repository_import/repository_spec.rb b/spec/lib/gitlab/bare_repository_import/repository_spec.rb index 2db737f5fb6..61b73abcba4 100644 --- a/spec/lib/gitlab/bare_repository_import/repository_spec.rb +++ b/spec/lib/gitlab/bare_repository_import/repository_spec.rb @@ -46,6 +46,13 @@ describe ::Gitlab::BareRepositoryImport::Repository do describe '#project_full_path' do it 'returns the project full path' do expect(project_repo_path.repo_path).to eq('/full/path/to/repo.git') + expect(project_repo_path.project_full_path).to eq('to/repo') + end + + it 'with no trailing slash in the root path' do + repo_path = described_class.new('/full/path', '/full/path/to/repo.git') + + expect(repo_path.project_full_path).to eq('to/repo') end end end |