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/throttle_spec.rb')
-rw-r--r--spec/lib/gitlab/throttle_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/lib/gitlab/throttle_spec.rb b/spec/lib/gitlab/throttle_spec.rb
index 7462b2e1c38..50d723193ac 100644
--- a/spec/lib/gitlab/throttle_spec.rb
+++ b/spec/lib/gitlab/throttle_spec.rb
@@ -30,4 +30,32 @@ RSpec.describe Gitlab::Throttle do
end
end
end
+
+ describe '.rate_limiting_response_text' do
+ subject { described_class.rate_limiting_response_text }
+
+ context 'when the setting is not present' do
+ before do
+ stub_application_setting(rate_limiting_response_text: '')
+ end
+
+ it 'returns the default value with a trailing newline' do
+ expect(subject).to eq(described_class::DEFAULT_RATE_LIMITING_RESPONSE_TEXT + "\n")
+ end
+ end
+
+ context 'when the setting is present' do
+ let(:response_text) do
+ 'Rate limit exceeded; see https://docs.gitlab.com/ee/user/gitlab_com/#gitlabcom-specific-rate-limits for more details'
+ end
+
+ before do
+ stub_application_setting(rate_limiting_response_text: response_text)
+ end
+
+ it 'returns the default value with a trailing newline' do
+ expect(subject).to eq(response_text + "\n")
+ end
+ end
+ end
end