Adapt serializer specs to the new format
This commit is contained in:
parent
ac3be77219
commit
4256cdc06b
5 changed files with 122 additions and 138 deletions
|
|
@ -8,18 +8,16 @@ describe EventSerializer, type: :serializer do
|
||||||
context 'event does not have date, room and tracks assigned' do
|
context 'event does not have date, room and tracks assigned' do
|
||||||
it 'sets guid, title, length, abstract and type' do
|
it 'sets guid, title, length, abstract and type' do
|
||||||
expected_json = {
|
expected_json = {
|
||||||
event: {
|
guid: event.guid,
|
||||||
guid: event.guid,
|
title: 'Some Talk',
|
||||||
title: 'Some Talk',
|
length: 30,
|
||||||
length: 30,
|
scheduled_date: '',
|
||||||
scheduled_date: '',
|
language: nil,
|
||||||
language: nil,
|
abstract: 'Lorem ipsum dolor sit amet',
|
||||||
abstract: 'Lorem ipsum dolor sit amet',
|
speaker_ids: event.speaker_ids,
|
||||||
speaker_ids: event.speaker_ids,
|
type: 'Example Event Type',
|
||||||
type: 'Example Event Type',
|
room: nil,
|
||||||
room: nil,
|
track: nil
|
||||||
track: nil
|
|
||||||
}
|
|
||||||
}.to_json
|
}.to_json
|
||||||
|
|
||||||
expect(serializer.to_json).to eq expected_json
|
expect(serializer.to_json).to eq expected_json
|
||||||
|
|
@ -40,18 +38,16 @@ describe EventSerializer, type: :serializer do
|
||||||
|
|
||||||
it 'sets guid, title, length, abstract, type, date, language, speakers, room and track' do
|
it 'sets guid, title, length, abstract, type, date, language, speakers, room and track' do
|
||||||
expected_json = {
|
expected_json = {
|
||||||
event: {
|
guid: event.guid,
|
||||||
guid: event.guid,
|
title: 'Some Talk',
|
||||||
title: 'Some Talk',
|
length: 30,
|
||||||
length: 30,
|
scheduled_date: ' 2014-03-04T09:00:00+0000 ',
|
||||||
scheduled_date: ' 2014-03-04T09:00:00+0000 ',
|
language: 'English',
|
||||||
language: 'English',
|
abstract: 'Lorem ipsum dolor sit amet',
|
||||||
abstract: 'Lorem ipsum dolor sit amet',
|
speaker_ids: [speaker.id],
|
||||||
speaker_ids: [speaker.id],
|
type: 'Example Event Type',
|
||||||
type: 'Example Event Type',
|
room: room.guid,
|
||||||
room: room.guid,
|
track: track.guid
|
||||||
track: track.guid
|
|
||||||
}
|
|
||||||
}.to_json
|
}.to_json
|
||||||
|
|
||||||
expect(serializer.to_json).to eq expected_json
|
expect(serializer.to_json).to eq expected_json
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,9 @@ describe RoomSerializer, type: :serializer do
|
||||||
|
|
||||||
it 'set guid, name and description' do
|
it 'set guid, name and description' do
|
||||||
expected_json = {
|
expected_json = {
|
||||||
room: {
|
guid: room.guid,
|
||||||
guid: room.guid,
|
name: room.name,
|
||||||
name: room.name,
|
description: ''
|
||||||
description: ''
|
|
||||||
}
|
|
||||||
}.to_json
|
}.to_json
|
||||||
|
|
||||||
expect(serializer.to_json).to eq expected_json
|
expect(serializer.to_json).to eq expected_json
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,9 @@ describe SpeakerSerializer, type: :serializer do
|
||||||
context 'speaker does not have biography' do
|
context 'speaker does not have biography' do
|
||||||
it 'sets name and affiliation' do
|
it 'sets name and affiliation' do
|
||||||
expected_json = {
|
expected_json = {
|
||||||
speaker: {
|
name: 'John Doe',
|
||||||
name: 'John Doe',
|
affiliation: 'JohnDoesInc',
|
||||||
affiliation: 'JohnDoesInc',
|
biography: nil
|
||||||
biography: nil
|
|
||||||
}
|
|
||||||
}.to_json
|
}.to_json
|
||||||
|
|
||||||
expect(serializer.to_json).to eq expected_json
|
expect(serializer.to_json).to eq expected_json
|
||||||
|
|
@ -24,11 +22,9 @@ describe SpeakerSerializer, type: :serializer do
|
||||||
|
|
||||||
it 'sets name, affiliation and biography' do
|
it 'sets name, affiliation and biography' do
|
||||||
expected_json = {
|
expected_json = {
|
||||||
speaker: {
|
name: 'John Doe',
|
||||||
name: 'John Doe',
|
affiliation: 'JohnDoesInc',
|
||||||
affiliation: 'JohnDoesInc',
|
biography: 'Doest of all Jon Does'
|
||||||
biography: 'Doest of all Jon Does'
|
|
||||||
}
|
|
||||||
}.to_json
|
}.to_json
|
||||||
|
|
||||||
expect(serializer.to_json).to eq expected_json
|
expect(serializer.to_json).to eq expected_json
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,9 @@ describe TrackSerializer, type: :serializer do
|
||||||
|
|
||||||
it 'sets guild, name, color' do
|
it 'sets guild, name, color' do
|
||||||
expected_json = {
|
expected_json = {
|
||||||
track: {
|
guid: track.guid,
|
||||||
guid: track.guid,
|
name: track.name,
|
||||||
name: track.name,
|
color: track.color
|
||||||
color: track.color
|
|
||||||
}
|
|
||||||
}.to_json
|
}.to_json
|
||||||
|
|
||||||
expect(serializer.to_json).to eq expected_json
|
expect(serializer.to_json).to eq expected_json
|
||||||
|
|
|
||||||
|
|
@ -1,100 +1,96 @@
|
||||||
{
|
{
|
||||||
"type": "object",
|
"conference" : {
|
||||||
"required": ["conference"],
|
"type" : "object",
|
||||||
"properties": {
|
"required" : [
|
||||||
"conference" : {
|
"short_title",
|
||||||
"type" : "object",
|
"title",
|
||||||
"required" : [
|
"description",
|
||||||
"short_title",
|
"start_date",
|
||||||
"title",
|
"end_date",
|
||||||
"description",
|
"picture_url",
|
||||||
"start_date",
|
"difficulty_levels",
|
||||||
"end_date",
|
"event_types",
|
||||||
"picture_url",
|
"rooms",
|
||||||
"difficulty_levels",
|
"tracks",
|
||||||
"event_types",
|
"date_range",
|
||||||
"rooms",
|
"revision"
|
||||||
"tracks",
|
],
|
||||||
"date_range",
|
"properties" : {
|
||||||
"revision"
|
"short_title": {
|
||||||
],
|
"type": "string"
|
||||||
"properties" : {
|
},
|
||||||
"short_title": {
|
"title": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"title": {
|
"description": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"description": {
|
"start_date": {
|
||||||
"type": "string"
|
"type": "string", "format": "date"
|
||||||
},
|
},
|
||||||
"start_date": {
|
"end_date": {
|
||||||
"type": "string", "format": "date"
|
"type": "string", "format": "date"
|
||||||
},
|
},
|
||||||
"end_date": {
|
"picture_url": {
|
||||||
"type": "string", "format": "date"
|
"anyOf": [
|
||||||
},
|
{ "type": "string" },
|
||||||
"picture_url": {
|
{ "type": "null" }
|
||||||
"anyOf": [
|
]
|
||||||
{ "type": "string" },
|
},
|
||||||
{ "type": "null" }
|
"difficulty_levels": {
|
||||||
]
|
"type": "array",
|
||||||
},
|
"items": {
|
||||||
"difficulty_levels": {
|
"type": "object",
|
||||||
"type": "array",
|
"required": ["id", "title", "description"],
|
||||||
"items": {
|
"properties": {
|
||||||
"type": "object",
|
"id": { "type": "integer" },
|
||||||
"required": ["id", "title", "description"],
|
"title": { "type": "string" },
|
||||||
"properties": {
|
"description": { "type": "string" }
|
||||||
"id": { "type": "integer" },
|
|
||||||
"title": { "type": "string" },
|
|
||||||
"description": { "type": "string" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"event_types": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"required": ["id", "title", "description", "length"],
|
|
||||||
"properties": {
|
|
||||||
"id": { "type": "integer" },
|
|
||||||
"title": { "type": "string" },
|
|
||||||
"description": { "type": "string" },
|
|
||||||
"length": { "type": "integer" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rooms": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"required": ["id", "size", "events"],
|
|
||||||
"properties": {
|
|
||||||
"id": { "type": "integer" },
|
|
||||||
"size": { "type": "integer" },
|
|
||||||
"events": { "type": "array" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tracks": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"required": ["id", "name", "description"],
|
|
||||||
"properties": {
|
|
||||||
"id": { "type": "integer" },
|
|
||||||
"name": { "type": "string" },
|
|
||||||
"description": { "type": "string" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"date_range": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"revision": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"event_types": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "title", "description", "length"],
|
||||||
|
"properties": {
|
||||||
|
"id": { "type": "integer" },
|
||||||
|
"title": { "type": "string" },
|
||||||
|
"description": { "type": "string" },
|
||||||
|
"length": { "type": "integer" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rooms": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "size", "events"],
|
||||||
|
"properties": {
|
||||||
|
"id": { "type": "integer" },
|
||||||
|
"size": { "type": "integer" },
|
||||||
|
"events": { "type": "array" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tracks": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "name", "description"],
|
||||||
|
"properties": {
|
||||||
|
"id": { "type": "integer" },
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"description": { "type": "string" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"date_range": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"revision": {
|
||||||
|
"type": "integer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue