summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-11-23 17:01:47 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-11-23 17:01:47 +0000
commitdd11f0e053688fdec404b43ddf97d105e7d02f14 (patch)
treeed881fe574041287fd8d120e8b6c9c08115c29c7 /spec
parentd22c885743510d5bdc990d7224489ea8e4156f2c (diff)
parent7a1e93d35b7280db8bc4128862c86223d76a8d6d (diff)
downloadgitlab-ce-dd11f0e053688fdec404b43ddf97d105e7d02f14.tar.gz
Merge branch 'dm-cleanup-fetch-and-mirror-methods' into 'master'
Clean up repository fetch and mirror methods See merge request gitlab-org/gitlab-ce!15424
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb25
-rw-r--r--spec/lib/gitlab/github_import/importer/repository_importer_spec.rb41
2 files changed, 7 insertions, 59 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index 9da33b94c5e..2f49bd1bcf2 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -588,12 +588,12 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
- describe '#fetch_mirror' do
+ describe '#fetch_as_mirror_without_shell' do
let(:new_repository) do
Gitlab::Git::Repository.new('default', 'my_project.git', '')
end
- subject { new_repository.fetch_mirror(repository.path) }
+ subject { new_repository.fetch_as_mirror_without_shell(repository.path) }
before do
Gitlab::Shell.new.add_repository('default', 'my_project')
@@ -1652,15 +1652,15 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
- describe '#fetch' do
+ describe '#fetch_remote_without_shell' do
let(:git_path) { Gitlab.config.git.bin_path }
let(:remote_name) { 'my_remote' }
- subject { repository.fetch(remote_name) }
+ subject { repository.fetch_remote_without_shell(remote_name) }
it 'fetches the remote and returns true if the command was successful' do
expect(repository).to receive(:popen)
- .with(%W(#{git_path} fetch #{remote_name}), repository.path)
+ .with(%W(#{git_path} fetch #{remote_name}), repository.path, {})
.and_return(['', 0])
expect(subject).to be(true)
@@ -1777,21 +1777,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
- describe '#fetch' do
- let(:git_path) { Gitlab.config.git.bin_path }
- let(:remote_name) { 'my_remote' }
-
- subject { repository.fetch(remote_name) }
-
- it 'fetches the remote and returns true if the command was successful' do
- expect(repository).to receive(:popen)
- .with(%W(#{git_path} fetch #{remote_name}), repository.path)
- .and_return(['', 0])
-
- expect(subject).to be(true)
- end
- end
-
describe '#delete_all_refs_except' do
let(:repository) do
Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '')
diff --git a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
index 80539807711..168e5d07504 100644
--- a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
@@ -164,12 +164,9 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do
expect(project)
.to receive(:ensure_repository)
- expect(importer)
- .to receive(:configure_repository_remote)
-
expect(repository)
- .to receive(:fetch_remote)
- .with('github', forced: true)
+ .to receive(:fetch_as_mirror)
+ .with(project.import_url, refmap: Gitlab::GithubImport.refmap, forced: true, remote_name: 'github')
expect(importer.import_repository).to eq(true)
end
@@ -186,40 +183,6 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do
end
end
- describe '#configure_repository_remote' do
- it 'configures the remote details' do
- expect(repository)
- .to receive(:remote_exists?)
- .with('github')
- .and_return(false)
-
- expect(repository)
- .to receive(:add_remote)
- .with('github', 'foo.git')
-
- expect(repository)
- .to receive(:set_import_remote_as_mirror)
- .with('github')
-
- expect(repository)
- .to receive(:add_remote_fetch_config)
-
- importer.configure_repository_remote
- end
-
- it 'does not configure the remote if already configured' do
- expect(repository)
- .to receive(:remote_exists?)
- .with('github')
- .and_return(true)
-
- expect(repository)
- .not_to receive(:add_remote)
-
- importer.configure_repository_remote
- end
- end
-
describe '#import_wiki_repository' do
it 'imports the wiki repository' do
expect(importer.gitlab_shell)