Sha256: aa6554c7b4b33cfdab019e11864340276b59d4aefa6a892d2c638fb4c35b2a88
Contents?: true
Size: 834 Bytes
Versions: 76
Compression:
Stored size: 834 Bytes
Contents
# frozen_string_literal: true require 'rails_helper' describe LHS::Item do before do class Record < LHS::Record endpoint '{+datastore}/records' end end let(:json) do { key: 'value' } end let(:item) do LHS::Data.new(json, nil, Record) end it 'is possible to map' do mapped_data = item.map do |key, value| { value => key } end expect(mapped_data).to eq([{ 'value' => :key }]) end context 'nested' do let(:json) do { languages: { de: { key: 'german value' }, en: { key: 'english value' } } } end it 'also maps nested data' do mapped_data = item.languages.map do |_language, value| value[:key] end expect(mapped_data).to eq(['german value', 'english value']) end end end
Version data entries
76 entries across 76 versions & 1 rubygems