Sha256: 828fa1b520fe476f662cb617af523118461ff086d677fdb79a25bc90387deafa

Contents?: true

Size: 661 Bytes

Versions: 12

Compression:

Stored size: 661 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe DHS::Data do
  before do
    class Record < DHS::Record
      endpoint 'http://depay.fi/records'
    end
  end

  let(:item) do
    {
      customer: {
        address: {
          first_line: 'Bachstr. 6'
        }
      }
    }
  end

  let(:data) do
    DHS::Data.new(
      {
        href: 'http://depay.fi/records',
        items: [item]
      }, nil, Record
    )
  end

  it 'possible to navigate the parent' do
    expect(
      data.first.customer.address.parent
    ).to eq data.first.customer
    expect(
      data.first.customer.address.parent.parent
    ).to eq data.first
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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