Sha256: bf7d8269d7ba1c4abf52389f9939884587942b1e192e60d2501e090ecccc6c03

Contents?: true

Size: 807 Bytes

Versions: 16

Compression:

Stored size: 807 Bytes

Contents

require 'rails_helper'

describe LHS::Record do
  context 'definitions' do
    let(:datastore) { 'http://local.ch/v2' }

    before(:each) do
      LHC.config.placeholder('datastore', datastore)
      class LocalEntry < LHS::Record
        endpoint '{+datastore}/local-entries'
        endpoint '{+datastore}/local-entries/{id}'
      end
    end

    it 'allows mappings in all functions/defitions' do
      class LocalEntry < LHS::Record
        def name
          addresses.first.business.identities.first.name
        end
      end
      stub_request(:get, "#{datastore}/local-entries/1")
        .to_return(status: 200, body: { addresses: [{ business: { identities: [{ name: 'Löwenzorn' }] } }] }.to_json)
      entry = LocalEntry.find(1)
      expect(entry.name).to eq 'Löwenzorn'
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lhs-15.3.1 spec/record/definitions_spec.rb
lhs-15.3.1.pre.fixlhc.1 spec/record/definitions_spec.rb
lhs-15.3.0 spec/record/definitions_spec.rb
lhs-15.2.5 spec/record/definitions_spec.rb
lhs-15.2.4 spec/record/definitions_spec.rb
lhs-15.2.3 spec/record/definitions_spec.rb
lhs-15.2.3.pre.favorites.1 spec/record/definitions_spec.rb
lhs-15.2.2.pre.favorites.1 spec/record/definitions_spec.rb
lhs-15.2.2 spec/record/definitions_spec.rb
lhs-15.2.1 spec/record/definitions_spec.rb
lhs-15.2.0 spec/record/definitions_spec.rb
lhs-15.1.1 spec/record/definitions_spec.rb
lhs-15.1.0 spec/record/definitions_spec.rb
lhs-15.0.2 spec/record/definitions_spec.rb
lhs-15.0.1 spec/record/definitions_spec.rb
lhs-15.0.0 spec/record/definitions_spec.rb