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/api/entities/hook_spec.rb')
-rw-r--r--spec/lib/api/entities/hook_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/lib/api/entities/hook_spec.rb b/spec/lib/api/entities/hook_spec.rb
new file mode 100644
index 00000000000..45648d6fb64
--- /dev/null
+++ b/spec/lib/api/entities/hook_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe API::Entities::Hook, feature_category: :webhooks do
+ let(:hook) { create(:project_hook) }
+ let(:with_url_variables) { true }
+ let(:entity) { described_class.new(hook, with_url_variables: with_url_variables) }
+
+ subject(:json) { entity.as_json }
+
+ it 'exposes correct attributes' do
+ expect(json.keys).to contain_exactly(:alert_status, :created_at, :disabled_until, :enable_ssl_verification, :id,
+ :merge_requests_events, :push_events, :repository_update_events, :tag_push_events, :url, :url_variables
+ )
+ end
+
+ context 'when `with_url_variables` is set to false' do
+ let(:with_url_variables) { false }
+
+ it 'does not expose `with_url_variables` field' do
+ expect(json.keys).not_to include(:url_variables)
+ end
+ end
+end