Sha256: 7a39f35c0f6ddf3ee64320c45a7a981d7f6fa81ee46725dcff9302de54aa9040

Contents?: true

Size: 777 Bytes

Versions: 10

Compression:

Stored size: 777 Bytes

Contents

require 'spec_helper'

RSpec.describe RockRMS::Response::DefinedValue, type: :model do
  let(:parsed) { JSON.parse(FixturesHelper.read('defined_values.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 'has the correct number keys' do
      keys = result.first.keys
      expect(keys.count).to eq(11)
    end

    it 'translates keys' do
      result.zip(parsed) do |r, p|
        expect(r[:id]).to eq(p['Id'])
        expect(r[:value]).to eq(p['Value'])
        expect(r[:guid]).to eq(p['Guid'])
        expect(r[:description]).to eq(p['Description'])
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rock_rms-9.9.0 spec/rock_rms/response/defined_value_spec.rb
rock_rms-9.8.0 spec/rock_rms/response/defined_value_spec.rb
rock_rms-9.7.0 spec/rock_rms/response/defined_value_spec.rb
rock_rms-9.6.0 spec/rock_rms/response/defined_value_spec.rb
rock_rms-9.5.0 spec/rock_rms/response/defined_value_spec.rb
rock_rms-9.4.0 spec/rock_rms/response/defined_value_spec.rb
rock_rms-9.3.0 spec/rock_rms/response/defined_value_spec.rb
rock_rms-9.2.0 spec/rock_rms/response/defined_value_spec.rb
rock_rms-9.1.0 spec/rock_rms/response/defined_value_spec.rb
rock_rms-9.0.0 spec/rock_rms/response/defined_value_spec.rb