summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-10-09 18:25:24 -0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-11-03 14:33:24 -0300
commit88d2517e362accea4e51947e49a2587b5012dbc6 (patch)
tree704a30a0b8e1ff90951ff3ff41bd44dbc5351286
parent4154fa28e948532f15e00b0094e9fc83545a6865 (diff)
downloadgitlab-ce-88d2517e362accea4e51947e49a2587b5012dbc6.tar.gz
Add `Gitlab::Git::Repository#fetch` command
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index bf6d199ebe2..8f1a7221f8f 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -1685,6 +1685,21 @@ 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
+
def create_remote_branch(repository, remote_name, branch_name, source_branch_name)
source_branch = repository.branches.find { |branch| branch.name == source_branch_name }
rugged = repository.rugged