# frozen_string_literal: true RSpec.shared_examples "error_collection" do |codes| if codes.include?("400") response 400, " Недопустимые параметры" do let(:params) { {data: "invalid"} } schema "$ref": "#/components/schemas/ErrorsOutput" run_test! end end if codes.include?("401") response 401, "Учетная запись не авторизована" do let(:Authorization) { nil } schema "$ref": "#/components/schemas/ErrorsOutput" run_test! end end if codes.include?("403") response 403, "Нет прав доступа к ресурсу" do let(:permissions) {[]} schema "$ref": "#/components/schemas/ErrorsOutput" run_test! end end if codes.include?("404") response 404, "Ресурс не найден" do let(:organization_id) { SecureRandom.uuid } schema "$ref": "#/components/schemas/ErrorsOutput" run_test! end end if codes.include?("422") response 422, "Недопустимая модель ресурса" do let(:params) { invalid_params } schema "$ref": "#/components/schemas/ErrorsOutput" run_test! end end end