Add room and track serilizer tests
This commit is contained in:
parent
80f63c7263
commit
a786321800
2 changed files with 35 additions and 0 deletions
17
spec/serializers/room_serializer_spec.rb
Normal file
17
spec/serializers/room_serializer_spec.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
require 'spec_helper'
|
||||
describe RoomSerializer, type: :serializer do
|
||||
let(:room) { create(:room) }
|
||||
let(:serializer) { RoomSerializer.new(room) }
|
||||
|
||||
it 'set guid, name and description' do
|
||||
expected_json = {
|
||||
room: {
|
||||
guid: room.guid,
|
||||
name: 'Example Room',
|
||||
description: ''
|
||||
}
|
||||
}.to_json
|
||||
|
||||
expect(serializer.to_json).to eq expected_json
|
||||
end
|
||||
end
|
||||
18
spec/serializers/track_serializer_spec.rb
Normal file
18
spec/serializers/track_serializer_spec.rb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe TrackSerializer, type: :serializer do
|
||||
let(:track) { create(:track) }
|
||||
let(:serializer) { TrackSerializer.new(track) }
|
||||
|
||||
it 'sets guild, name, color' do
|
||||
expected_json = {
|
||||
track: {
|
||||
guid: track.guid,
|
||||
name: 'Example Track',
|
||||
color: '#ffffff'
|
||||
}
|
||||
}.to_json
|
||||
|
||||
expect(serializer.to_json).to eq expected_json
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue