Sha256: 1f6074cbe83a3c1b79ff4a39f331bd4910cca8c22ec65050ebcfd9aeee2d4861

Contents?: true

Size: 674 Bytes

Versions: 16

Compression:

Stored size: 674 Bytes

Contents

require 'rails_helper'

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

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

  let(:data) {
    {
      'authorities' => ['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

16 entries across 16 versions & 1 rubygems

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