osem-fcy/spec/services/full_calendar_formatter_spec.rb

27 lines
593 B
Ruby
Raw Normal View History

2021-04-24 19:30:52 -07:00
# frozen_string_literal: true
require 'spec_helper'
describe FullCalendarFormatter do
let!(:room1) { create(:room) }
let!(:room2) { create(:room) }
2021-04-24 19:30:52 -07:00
describe 'JSON formatting for FullCalendar' do
it 'translates rooms to resources' do
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)
2021-04-24 19:30:52 -07:00
end
end
end