Sha256: 176a895293c490b5214b2fd894542749171a62b5c9734d1eade79fc31c8be7e8
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
require 'spec_helper' RSpec.describe RockRMS::Responses::GroupLocation, type: :model do let(:parsed) { JSON.parse(FixturesHelper.read('group_locations.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[:group_id]).to eq(p['GroupId']) expect(r[:location_id]).to eq(p['LocationId']) expect(r[:guid]).to eq(p['Guid']) end end context 'when locations are included' do it 'formats with Location' do location = double parsed.first['Location'] = location expect(RockRMS::Responses::Location).to receive(:format) .with(location) .and_return({ some_key: :value }) result expect(result.first[:location]).to eq({ some_key: :value }) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rock_rms-1.2.0 | spec/rock_rms/responses/group_location_spec.rb |
rock_rms-1.1.0 | spec/rock_rms/responses/group_location_spec.rb |