[feat]Implement FullCalendar#rooms_to_resources and add tests
This commit is contained in:
parent
54d7c31cac
commit
e1918fbf7e
4 changed files with 59 additions and 29 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue