mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-01 08:38:04 +08:00
This commit converts the api docs spec for the invite endpoint to use the new json schema file format.
31 lines
1.1 KiB
Ruby
31 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
require "swagger_helper"
|
|
|
|
RSpec.describe "invites" do
|
|
let(:"Api-Key") { Fabricate(:api_key).key }
|
|
let(:"Api-Username") { "system" }
|
|
|
|
path "/invites.json" do
|
|
post "Create an invite" do
|
|
tags "Invites"
|
|
operationId "createInvite"
|
|
consumes "application/json"
|
|
parameter name: "Api-Key", in: :header, type: :string, required: true
|
|
parameter name: "Api-Username", in: :header, type: :string, required: true
|
|
expected_request_schema = load_spec_schema("invite_create_request")
|
|
parameter name: :params, in: :body, schema: expected_request_schema
|
|
|
|
produces "application/json"
|
|
response "200", "success response" do
|
|
expected_response_schema = load_spec_schema("invite_create_response")
|
|
schema expected_response_schema
|
|
|
|
let(:params) { { email: "not-a-user-yet@example.com" } }
|
|
it_behaves_like "a JSON endpoint", 200 do
|
|
let(:expected_response_schema) { expected_response_schema }
|
|
let(:expected_request_schema) { expected_request_schema }
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|