Sha256: 6849d45aa713f9043c4648c5a80aa1e72ea7a75deda29db183e08ff03fb21c81

Contents?: true

Size: 835 Bytes

Versions: 58

Compression:

Stored size: 835 Bytes

Contents

require 'rails_helper'

describe LHS::Data do
  let(:json) do
    load_json(:feedbacks)
  end

  let(:data) do
    LHS::Data.new(json, nil, Record)
  end

  before(:each) do
    class Record < LHS::Record
      endpoint ':datastore/v2/data'
    end
  end

  context 'collections' do
    it 'forwards calls to the collection' do
      expect(data.count).to be_kind_of Integer
      expect(data[0]).to be_kind_of LHS::Data
      expect(data.sample).to be_kind_of LHS::Data
    end

    it 'provides a total method to get the number of total records' do
      expect(data.total).to be_kind_of Integer
    end
  end

  context 'collections from arrays' do
    let(:data) do
      LHS::Data.new([1, 2, 3, 4])
    end

    it 'uses collection as proxy for arrays' do
      expect(data._proxy).to be_kind_of LHS::Collection
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
lhs-13.2.2 spec/data/collection_spec.rb
lhs-13.2.1 spec/data/collection_spec.rb
lhs-13.2.0 spec/data/collection_spec.rb
lhs-13.1.0 spec/data/collection_spec.rb
lhs-13.0.1 spec/data/collection_spec.rb
lhs-13.0.0 spec/data/collection_spec.rb
lhs-12.3.0 spec/data/collection_spec.rb
lhs-12.2.1 spec/data/collection_spec.rb
lhs-12.2.0 spec/data/collection_spec.rb
lhs-12.1.0 spec/data/collection_spec.rb
lhs-12.0.3 spec/data/collection_spec.rb
lhs-12.0.2 spec/data/collection_spec.rb
lhs-12.0.1 spec/data/collection_spec.rb
lhs-12.0.0 spec/data/collection_spec.rb
lhs-11.3.3 spec/data/collection_spec.rb
lhs-11.3.2 spec/data/collection_spec.rb
lhs-11.3.1 spec/data/collection_spec.rb
lhs-11.3.0 spec/data/collection_spec.rb
lhs-11.2.2 spec/data/collection_spec.rb
lhs-11.2.1 spec/data/collection_spec.rb