Commit 71011b0a authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch '323360-change-pagination-params' into 'master'

Remove pagination params from external approval rule creation

See merge request gitlab-org/gitlab!56328
parents 0f1c19fd 1e70bb03
......@@ -23,7 +23,6 @@ module API
requires :name, type: String, desc: 'The name of the rule'
requires :external_url, type: String, desc: 'The URL to notify when MR receives new commits'
optional :protected_branch_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The protected branch ids for this rule'
use :pagination
end
desc 'Create a new external approval rule' do
success ::API::Entities::ExternalApprovalRule
......@@ -44,6 +43,9 @@ module API
desc 'List project\'s external approval rules' do
detail 'This feature is gated by the :ff_compliance_approval_gates feature flag.'
end
params do
use :pagination
end
get do
unauthorized! unless current_user.can?(:admin_project, @project)
......
......@@ -56,8 +56,11 @@ RSpec.describe ::API::ExternalApprovalRules do
create(:external_approval_rule) # Creating an orphaned rule to make sure project scoping works as expected
end
it 'responds with expected JSON', :aggregate_failures do
before do
stub_licensed_features(compliance_approval_gates: true)
end
it 'responds with expected JSON', :aggregate_failures do
get api(collection_url, project.owner)
expect(json_response.size).to eq(2)
......@@ -65,6 +68,12 @@ RSpec.describe ::API::ExternalApprovalRules do
expect(json_response.map { |r| r['external_url'] }).to contain_exactly('http://rule1.example', 'https://rule2.example')
end
it 'paginates correctly' do
get api(collection_url, project.owner), params: { per_page: 1 }
expect_paginated_array_response([1])
end
context 'when feature is disabled, unlicensed or user has permission' do
where(:licensed, :flag, :project_owner, :status) do
false | false | false | :not_found
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment