Sha256: bf8b8b59158249b8ddb57ab6e046822a78d3bef83c08a5797144274b6f4d4e2a

Contents?: true

Size: 802 Bytes

Versions: 130

Compression:

Stored size: 802 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

130 entries across 130 versions & 1 rubygems

Version Path
lhs-14.6.5 spec/record/definitions_spec.rb
lhs-14.6.4 spec/record/definitions_spec.rb
lhs-14.6.3 spec/record/definitions_spec.rb
lhs-14.6.2 spec/record/definitions_spec.rb
lhs-14.6.1 spec/record/definitions_spec.rb
lhs-14.6.0 spec/record/definitions_spec.rb
lhs-14.5.0 spec/record/definitions_spec.rb
lhs-14.4.0 spec/record/definitions_spec.rb
lhs-14.3.4 spec/record/definitions_spec.rb
lhs-14.3.3 spec/record/definitions_spec.rb
lhs-14.3.2 spec/record/definitions_spec.rb
lhs-14.3.1 spec/record/definitions_spec.rb
lhs-14.3.0 spec/record/definitions_spec.rb
lhs-14.2.0 spec/record/definitions_spec.rb
lhs-14.1.1 spec/record/definitions_spec.rb
lhs-14.1.0 spec/record/definitions_spec.rb
lhs-14.0.3 spec/record/definitions_spec.rb
lhs-14.0.2 spec/record/definitions_spec.rb
lhs-14.0.1 spec/record/definitions_spec.rb
lhs-14.0.0 spec/record/definitions_spec.rb