Sha256: 01bae34355cb03ba0afec5fc65d6ae6d17f87b680c113cab04145ae93a00e3b6
Contents?: true
Size: 808 Bytes
Versions: 19
Compression:
Stored size: 808 Bytes
Contents
require 'rails_helper' describe LHS::Item do before(:each) 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
19 entries across 19 versions & 1 rubygems