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/services/web_hook_service_spec.rb')
-rw-r--r--spec/services/web_hook_service_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/services/web_hook_service_spec.rb b/spec/services/web_hook_service_spec.rb
index 2be481c5b62..b7b81d33c3e 100644
--- a/spec/services/web_hook_service_spec.rb
+++ b/spec/services/web_hook_service_spec.rb
@@ -13,9 +13,11 @@ RSpec.describe WebHookService do
'X-Gitlab-Event' => 'Push Hook'
}
end
+
let(:data) do
{ before: 'oldrev', after: 'newrev', ref: 'ref' }
end
+
let(:service_instance) { described_class.new(project_hook, data, :push_hooks) }
describe '#initialize' do
@@ -128,6 +130,14 @@ RSpec.describe WebHookService do
end
end
+ context 'when request body size is too big' do
+ it 'does not perform the request' do
+ stub_const("#{described_class}::REQUEST_BODY_SIZE_LIMIT", 10.bytes)
+
+ expect(service_instance.execute).to eq({ status: :error, message: "Gitlab::Json::LimitedEncoder::LimitExceeded" })
+ end
+ end
+
it 'handles 200 status code' do
stub_full_request(project_hook.url, method: :post).to_return(status: 200, body: 'Success')