Sha256: df0bd813de6c8a22f2265afe3eabdc00b2bc466f003d3c14136549fafa652ea1

Contents?: true

Size: 964 Bytes

Versions: 4

Compression:

Stored size: 964 Bytes

Contents

require 'spec_helper'

RSpec.describe RockRMS::Responses::Campus, type: :model do
  let(:parsed) { JSON.parse(FixturesHelper.read('campuses.json')) }

  describe '.format' do
    subject(:result) { described_class.format(parsed) }

    context 'when response is array' do
      it 'returns an array' do
        expect(described_class.format([])).to be_a(Array)
      end
    end

    it 'translates keys' do
      result.zip(parsed) do |r, p|
        expect(r[:id]).to eq(p['Id'])
        expect(r[:name]).to eq(p['Name'])
        expect(r[:is_active]).to eq(p['IsActive'])
        expect(r[:description]).to eq(p['Description'])
        expect(r[:short_code]).to eq(p['ShortCode'])
        expect(r[:url]).to eq(p['Url'])
        expect(r[:location_id]).to eq(p['LocationId'])
        expect(r[:phone_number]).to eq(p['PhoneNumber'])
        expect(r[:service_times]).to eq(p['ServiceTimes'])
        expect(r[:guid]).to eq(p['Guid'])
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rock_rms-2.0.0 spec/rock_rms/responses/campus_spec.rb
rock_rms-1.3.0 spec/rock_rms/responses/campus_spec.rb
rock_rms-1.2.0 spec/rock_rms/responses/campus_spec.rb
rock_rms-1.1.0 spec/rock_rms/responses/campus_spec.rb