[feat]Implement FullCalendar#rooms_to_resources and add tests

This commit is contained in:
Jimmy 2021-04-26 09:48:16 +08:00 committed by CactusPuppy
parent 40916b6a36
commit abe2ea9bb3
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
4 changed files with 59 additions and 29 deletions

View file

@ -3,12 +3,24 @@
require 'spec_helper'
describe FullCalendarFormatter do
let!(:room0) { create(:room) }
let!(:room1) { create(:room) }
let!(:room2) { create(:room) }
describe 'JSON formatting for FullCalendar' do
it 'translates rooms to resources' do
room_list = [room1, room2] # TODO
rooms = [room1, room2]
resources = described_class.rooms_to_resources(rooms)
expected_json = [
{
id: room1.guid,
title: room1.name
},
{
id: room2.guid,
title: room2.name
}
].to_json
expect(resources).to eq(expected_json)
end
end
end