summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/models/remote_mirror_spec.rb12
-rw-r--r--spec/services/projects/update_remote_mirror_service_spec.rb1
2 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/remote_mirror_spec.rb b/spec/models/remote_mirror_spec.rb
index c2ef0435c8e..269d5deca20 100644
--- a/spec/models/remote_mirror_spec.rb
+++ b/spec/models/remote_mirror_spec.rb
@@ -220,6 +220,18 @@ describe RemoteMirror do
end
end
+ context '#ensure_remote!' do
+ let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first }
+
+ it 'adds a remote multiple times with no errors' do
+ expect(remote_mirror.project.repository).to receive(:add_remote).with(remote_mirror.remote_name, remote_mirror.url).twice.and_call_original
+
+ 2.times do
+ remote_mirror.ensure_remote!
+ end
+ end
+ end
+
context '#updated_since?' do
let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first }
let(:timestamp) { Time.now - 5.minutes }
diff --git a/spec/services/projects/update_remote_mirror_service_spec.rb b/spec/services/projects/update_remote_mirror_service_spec.rb
index 5c2e79ff9af..96e8a80b334 100644
--- a/spec/services/projects/update_remote_mirror_service_spec.rb
+++ b/spec/services/projects/update_remote_mirror_service_spec.rb
@@ -18,6 +18,7 @@ describe Projects::UpdateRemoteMirrorService do
end
it "fetches the remote repository" do
+ expect(remote_mirror).to receive(:ensure_remote!).and_call_original
expect(repository).to receive(:fetch_remote).with(remote_mirror.remote_name, no_tags: true) do
sync_remote(repository, remote_mirror.remote_name, local_branch_names)
end