Sha256: cedd4c6917e581ebe88792b403ef39a32ffceea1f184209dd505fe46c0210748

Contents?: true

Size: 773 Bytes

Versions: 21

Compression:

Stored size: 773 Bytes

Contents

require 'rails_helper'

describe LHS::Data do
  before(:each) do
    class Record < LHS::Record
      endpoint 'http://local.ch/records'
    end
  end

  let(:item) do
    {
      customer: {
        addresses: [
          {
            first_line: 'Bachstr. 6'
          }
        ]
      }
    }
  end

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

  it 'provides the information which type of proxy data ist' do
    expect(data.collection?).to eq true
    expect(data.first.item?).to eq true
    expect(data.first.customer.item?).to eq true
    expect(data.first.customer.addresses.collection?).to eq true
    expect(data.first.customer.addresses.first.item?).to eq true
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
lhs-6.4.0 spec/data/is_item_or_collection_spec.rb
lhs-6.3.1 spec/data/is_item_or_collection_spec.rb
lhs-6.3.0 spec/data/is_item_or_collection_spec.rb
lhs-6.2.0 spec/data/is_item_or_collection_spec.rb
lhs-6.1.0 spec/data/is_item_or_collection_spec.rb
lhs-6.0.0 spec/data/is_item_or_collection_spec.rb
lhs-5.7.1 spec/data/is_item_or_collection_spec.rb
lhs-5.7.0 spec/data/is_item_or_collection_spec.rb
lhs-5.6.6 spec/data/is_item_or_collection_spec.rb
lhs-5.6.5 spec/data/is_item_or_collection_spec.rb
lhs-5.6.4 spec/data/is_item_or_collection_spec.rb
lhs-5.6.3 spec/data/is_item_or_collection_spec.rb
lhs-5.6.2 spec/data/is_item_or_collection_spec.rb
lhs-5.6.1 spec/data/is_item_or_collection_spec.rb
lhs-5.6.0 spec/data/is_item_or_collection_spec.rb
lhs-5.5.0 spec/data/is_item_or_collection_spec.rb
lhs-5.4.2 spec/data/is_item_or_collection_spec.rb
lhs-5.4.1 spec/data/is_item_or_collection_spec.rb
lhs-5.4.0 spec/data/is_item_or_collection_spec.rb
lhs-5.3.0 spec/data/is_item_or_collection_spec.rb