discourse/spec/requests/api/invites_spec.rb
Dan Ungureanu c047640ad4
FEATURE: Various improvements to invite system (#12023)
The user interface has been reorganized to show email and link invites
in the same screen. Staff has more control over creating and updating
invites. Bulk invite has also been improved with better explanations.

On the server side, many code paths for email and link invites have
been merged to avoid duplicated logic. The API returns better responses
with more appropriate HTTP status codes.
2021-03-03 11:45:29 +02:00

37 lines
1007 B
Ruby

# frozen_string_literal: true
require 'swagger_helper'
describe 'invites' do
let(:'Api-Key') { Fabricate(:api_key).key }
let(:'Api-Username') { 'system' }
path '/invites.json' do
post 'Invite to site by email' do
tags 'Invites'
consumes 'application/json'
parameter name: 'Api-Key', in: :header, type: :string, required: true
parameter name: 'Api-Username', in: :header, type: :string, required: true
parameter name: :request_body, in: :body, schema: {
type: :object,
properties: {
email: { type: :string },
group_names: { type: :string },
custom_message: { type: :string },
}, required: ['email']
}
produces 'application/json'
response '200', 'success response' do
schema type: :object, properties: {
success: { type: :string, example: "OK" }
}
let(:request_body) { { email: 'not-a-user-yet@example.com' } }
run_test!
end
end
end
end