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
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-11-09 11:37:41 +0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2017-11-10 22:26:55 +0300
commit355c59a35287b182dd02e4647d52411c22d81b6c (patch)
tree33199469feaabfd7f4eab20271ae4420a0069548 /spec
parent98baa929de998869095660474da0a89345d70993 (diff)
Merge branch 'github-rake-task-rate-limiting' into 'master'
Add GitHub enterprise support to the GitHub Rake task and better handle rate limiting being disabled See merge request gitlab-org/gitlab-ce!15284 (cherry picked from commit 760b2c75ef9d2c6acb655860dceae4c04cd8e5a7) 48cb1c50 Restore GH enterprise support in the Rake task f37fe2ed Support importing GH projects without rate limits
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/github_import/client_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/gitlab/github_import/client_spec.rb b/spec/lib/gitlab/github_import/client_spec.rb
index 9cbd9bcc14e..5b2642d9473 100644
--- a/spec/lib/gitlab/github_import/client_spec.rb
+++ b/spec/lib/gitlab/github_import/client_spec.rb
@@ -185,6 +185,17 @@ describe Gitlab::GithubImport::Client do
client.with_rate_limit { }
end
+
+ it 'ignores rate limiting when disabled' do
+ expect(client)
+ .to receive(:rate_limiting_enabled?)
+ .and_return(false)
+
+ expect(client)
+ .not_to receive(:requests_remaining?)
+
+ expect(client.with_rate_limit { 10 }).to eq(10)
+ end
end
describe '#requests_remaining?' do
@@ -362,4 +373,20 @@ describe Gitlab::GithubImport::Client do
end
end
end
+
+ describe '#rate_limiting_enabled?' do
+ let(:client) { described_class.new('foo') }
+
+ it 'returns true when using GitHub.com' do
+ expect(client.rate_limiting_enabled?).to eq(true)
+ end
+
+ it 'returns false for GitHub enterprise installations' do
+ expect(client)
+ .to receive(:api_endpoint)
+ .and_return('https://github.kittens.com/')
+
+ expect(client.rate_limiting_enabled?).to eq(false)
+ end
+ end
end