Sha256: 88a69e6da169bb6f0ee87a0329e035ce709d899dc686158285d40d81a37ff168

Contents?: true

Size: 669 Bytes

Versions: 12

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe DHS::Item do
  before do
    class Record < DHS::Record
      endpoint '{+datastore}/v2/{campaign_id}/feedbacks'
      endpoint '{+datastore}/v2/feedbacks'
    end
  end

  let(:data) do
    DHS::Data.new({ addresses: [{ business: { identities: [{ name: 'Löwenzorn' }] } }] }, nil, Record)
  end

  context 'item getter' do
    it 'returns a collection if you access an array' do
      expect(data.addresses).to be_kind_of(DHS::Data)
      expect(data.addresses._proxy).to be_kind_of(DHS::Collection)
      expect(data.addresses.first.business.identities.first.name).to eq 'Löwenzorn'
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dhs-1.6.0 spec/item/getter_spec.rb
dhs-1.5.0 spec/item/getter_spec.rb
dhs-1.4.2 spec/item/getter_spec.rb
dhs-1.4.1 spec/item/getter_spec.rb
dhs-1.4.0 spec/item/getter_spec.rb
dhs-1.3.0 spec/item/getter_spec.rb
dhs-1.2.0 spec/item/getter_spec.rb
dhs-1.1.0 spec/item/getter_spec.rb
dhs-1.0.3 spec/item/getter_spec.rb
dhs-1.0.2 spec/item/getter_spec.rb
dhs-1.0.1 spec/item/getter_spec.rb
dhs-1.0.0 spec/item/getter_spec.rb