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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-20 14:18:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-20 14:18:08 +0300
commit5afcbe03ead9ada87621888a31a62652b10a7e4f (patch)
tree9918b67a0d0f0bafa6542e839a8be37adf73102d /spec/lib/gitlab/github_import/client_spec.rb
parentc97c0201564848c1f53226fe19d71fdcc472f7d0 (diff)
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'spec/lib/gitlab/github_import/client_spec.rb')
-rw-r--r--spec/lib/gitlab/github_import/client_spec.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/lib/gitlab/github_import/client_spec.rb b/spec/lib/gitlab/github_import/client_spec.rb
index c9f7fd4f748..4b0d61e3188 100644
--- a/spec/lib/gitlab/github_import/client_spec.rb
+++ b/spec/lib/gitlab/github_import/client_spec.rb
@@ -20,11 +20,29 @@ RSpec.describe Gitlab::GithubImport::Client, feature_category: :importers do
end
describe '#user' do
+ let(:status_code) { 200 }
+ let(:body) { { id: 1 } }
+ let(:headers) { { 'Content-Type' => 'application/json' } }
+
+ before do
+ stub_request(:get, 'https://api.github.com/users/foo')
+ .to_return(status: status_code, body: body.to_json, headers: headers)
+ end
+
+ subject(:user) { client.user('foo') }
+
it 'returns the details for the given username' do
- expect(client.octokit).to receive(:user).with('foo')
expect(client).to receive(:with_rate_limit).and_yield
+ expect(user).to eq({ id: 1 })
+ end
+
+ context 'when a not modified response is returned' do
+ let(:status_code) { 304 }
- client.user('foo')
+ it 'returns nil' do
+ expect(client).to receive(:with_rate_limit).and_yield
+ expect(user).to eq(nil)
+ end
end
end