Merge pull request #3096 from AndrewKvalheim/api-urls

Add URLs to API responses
This commit is contained in:
Henne Vogelsang 2023-04-19 13:26:44 +02:00 committed by GitHub
commit 04b45adbe5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 48 additions and 8 deletions

View file

@ -9,6 +9,7 @@ describe EventSerializer, type: :serializer do
it 'sets guid, title, length, abstract and type' do
expected_json = {
guid: event.guid,
url: "http://localhost:3000/conferences/#{event.conference.short_title}/program/proposals/#{event.id}",
title: 'Some Talk',
length: 30,
scheduled_date: '',
@ -39,6 +40,7 @@ describe EventSerializer, type: :serializer do
it 'sets guid, title, length, abstract, type, date, language, speakers, room and track' do
expected_json = {
guid: event.guid,
url: "http://localhost:3000/conferences/#{event.conference.short_title}/program/proposals/#{event.id}",
title: 'Some Talk',
length: 30,
scheduled_date: ' 2014-03-04T09:00:00+0000 ',

View file

@ -8,6 +8,7 @@ describe SpeakerSerializer, type: :serializer do
context 'speaker does not have biography' do
it 'sets name and affiliation' do
expected_json = {
url: "http://localhost:3000/users/#{speaker.id}",
name: 'John Doe',
affiliation: 'JohnDoesInc',
biography: nil
@ -22,6 +23,7 @@ describe SpeakerSerializer, type: :serializer do
it 'sets name, affiliation and biography' do
expected_json = {
url: "http://localhost:3000/users/#{speaker.id}",
name: 'John Doe',
affiliation: 'JohnDoesInc',
biography: 'Doest of all Jon Does'

View file

@ -117,6 +117,11 @@ RSpec.configure do |config|
# end
# end
# Expect configured host instead of `test.host` (see https://stackoverflow.com/q/15414847)
config.before(:each, type: :controller) do
@request.host = Rails.application.routes.default_url_options[:host]
end
# use the config to use
# t('some.locale.key') instead of always having to type I18n.t
config.include AbstractController::Translation

View file

@ -3,6 +3,7 @@
"type" : "object",
"required" : [
"short_title",
"url",
"title",
"description",
"start_date",
@ -19,6 +20,9 @@
"short_title": {
"type": "string"
},
"url": {
"type": "string"
},
"title": {
"type": "string"
},