Sha256: 84d68ce3bebba64354a2e02e7058fa153923c63e72c60d7243d7e6f1b276043a
Contents?: true
Size: 695 Bytes
Versions: 12
Compression:
Stored size: 695 Bytes
Contents
# frozen_string_literal: true require 'rails_helper' describe DHS::Collection do let(:datastore) { 'http://depay.fi/v2' } before do DHC.config.placeholder('datastore', datastore) class Account < DHS::Record endpoint '{+datastore}/accounts/{id}' end end let(:data) { { 'authorities' => %w[ROLE_USER ROLE_LOCALCH_ACCOUNT] } } it 'lets you access items of an array if they are not objects' do stub_request(:get, "#{datastore}/accounts/1").to_return(status: 200, body: data.to_json) feedback = Account.find(1) expect(feedback.authorities.first).to eq 'ROLE_USER' expect(feedback.authorities[1]).to eq 'ROLE_LOCALCH_ACCOUNT' end end
Version data entries
12 entries across 12 versions & 1 rubygems