0
0
Fork 0

Add support for invite codes in the registration API (#27805)

This commit is contained in:
Claire 2023-11-13 14:27:00 +01:00 committed by GitHub
parent 5bca5c4c5b
commit 07a4059901
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 158 additions and 78 deletions

View file

@ -0,0 +1,27 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'invites' do
let(:invite) { Fabricate(:invite) }
context 'when requesting a JSON document' do
it 'returns a JSON document with expected attributes' do
get "/invite/#{invite.code}", headers: { 'Accept' => 'application/activity+json' }
expect(response).to have_http_status(200)
expect(response.media_type).to eq 'application/json'
expect(body_as_json[:invite_code]).to eq invite.code
end
end
context 'when not requesting a JSON document' do
it 'returns an HTML page' do
get "/invite/#{invite.code}"
expect(response).to have_http_status(200)
expect(response.media_type).to eq 'text/html'
end
end
end