Sha256: 97280a960a833401e685d96c6df0a7d90c39d41680bb6304176de4e0914b24c2

Contents?: true

Size: 727 Bytes

Versions: 76

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe LHS::Collection do
  let(:items) { [{ name: 'Steve' }] }
  let(:extra) { 'extra' }
  let(:collection) { Record.where }

  context 'to_a' do
    let(:response_data) do
      {
        items: items,
        extra: extra,
        total: 1
      }
    end

    let(:subject) { collection.to_a }

    before do
      class Record < LHS::Record
        endpoint 'http://datastore/records`'
      end
      stub_request(:get, %r{http://datastore/records})
        .to_return(body: response_data.to_json)
    end

    it 'returns an array and not LHS::Data' do
      expect(subject).to be_kind_of Array
      expect(subject).not_to be_kind_of LHS::Data
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
lhs-26.2.0 spec/collection/to_a_spec.rb
lhs-26.1.0 spec/collection/to_a_spec.rb
lhs-26.0.1 spec/collection/to_a_spec.rb
lhs-26.0.0 spec/collection/to_a_spec.rb
lhs-25.2.0 spec/collection/to_a_spec.rb
lhs-25.1.0 spec/collection/to_a_spec.rb
lhs-25.0.4 spec/collection/to_a_spec.rb
lhs-25.0.3 spec/collection/to_a_spec.rb
lhs-25.0.2 spec/collection/to_a_spec.rb
lhs-25.0.1 spec/collection/to_a_spec.rb
lhs-25.0.0 spec/collection/to_a_spec.rb
lhs-24.1.2 spec/collection/to_a_spec.rb
lhs-24.1.1 spec/collection/to_a_spec.rb
lhs-24.1.0 spec/collection/to_a_spec.rb
lhs-24.1.0.pre.2 spec/collection/to_a_spec.rb
lhs-24.1.0.pre.1 spec/collection/to_a_spec.rb
lhs-24.0.0 spec/collection/to_a_spec.rb
lhs-23.0.2 spec/collection/to_a_spec.rb
lhs-23.0.1 spec/collection/to_a_spec.rb
lhs-23.0.0 spec/collection/to_a_spec.rb