Sha256: af6f4d27db518b9a0e94fa1176ebe45069357c6f88c010a7d83fa97f532d3e38

Contents?: true

Size: 703 Bytes

Versions: 59

Compression:

Stored size: 703 Bytes

Contents

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(:each) 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

59 entries across 59 versions & 1 rubygems

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