From ec54777f4cc0313c8f96d6b7f07b92f3a9af3dd1 Mon Sep 17 00:00:00 2001 From: Blake Erickson Date: Mon, 8 Aug 2022 17:52:08 +0100 Subject: [PATCH] DEV: Use json schema file to describe update group endpoint (#17825) Updating another endpoint in our api docs to use json schema files for describing the request/response bodies. --- spec/requests/api/groups_spec.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 4cbc7cc952a..048c1f4e2c0 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -60,17 +60,9 @@ RSpec.describe 'groups' do operationId 'updateGroup' consumes 'application/json' parameter name: :id, in: :path, type: :integer - parameter name: :group, in: :body, schema: { - type: :object, - properties: { - group: { - type: :object, - properties: { - name: { type: :string }, - }, required: ['name'] - } - }, required: ['group'] - } + + expected_request_schema = load_spec_schema('group_create_request') + parameter name: :params, in: :body, schema: expected_request_schema produces 'application/json' response '200', 'success response' do @@ -79,7 +71,7 @@ RSpec.describe 'groups' do } let(:id) { Fabricate(:group).id } - let(:group) { { name: 'awesome' } } + let(:params) { { 'group' => { 'name' => 'awesome' } } } run_test! end