Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/harbor/client_spec.rb')
-rw-r--r--spec/lib/gitlab/harbor/client_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/lib/gitlab/harbor/client_spec.rb b/spec/lib/gitlab/harbor/client_spec.rb
new file mode 100644
index 00000000000..bc5b593370a
--- /dev/null
+++ b/spec/lib/gitlab/harbor/client_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Harbor::Client do
+ let(:harbor_integration) { build(:harbor_integration) }
+
+ subject(:client) { described_class.new(harbor_integration) }
+
+ describe '#ping' do
+ let!(:harbor_ping_request) { stub_harbor_request("https://demo.goharbor.io/api/v2.0/ping") }
+
+ it "calls api/v2.0/ping successfully" do
+ expect(client.ping).to eq(success: true)
+ end
+ end
+
+ private
+
+ def stub_harbor_request(url, body: {}, status: 200, headers: {})
+ stub_request(:get, url)
+ .to_return(
+ status: status,
+ headers: { 'Content-Type' => 'application/json' }.merge(headers),
+ body: body.to_json
+ )
+ end
+end