Sha256: 9d74b24739c8340ab32d3deed6b3fe82261d95327c47aa3823e23f10641505eb

Contents?: true

Size: 833 Bytes

Versions: 36

Compression:

Stored size: 833 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 Fixnum
      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 Fixnum
    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

36 entries across 36 versions & 1 rubygems

Version Path
lhs-6.6.1 spec/data/collection_spec.rb
lhs-6.6.0 spec/data/collection_spec.rb
lhs-6.5.0 spec/data/collection_spec.rb
lhs-6.4.0 spec/data/collection_spec.rb
lhs-6.3.1 spec/data/collection_spec.rb
lhs-6.3.0 spec/data/collection_spec.rb
lhs-6.2.0 spec/data/collection_spec.rb
lhs-6.1.0 spec/data/collection_spec.rb
lhs-6.0.0 spec/data/collection_spec.rb
lhs-5.7.1 spec/data/collection_spec.rb
lhs-5.7.0 spec/data/collection_spec.rb
lhs-5.6.6 spec/data/collection_spec.rb
lhs-5.6.5 spec/data/collection_spec.rb
lhs-5.6.4 spec/data/collection_spec.rb
lhs-5.6.3 spec/data/collection_spec.rb
lhs-5.6.2 spec/data/collection_spec.rb
lhs-5.6.1 spec/data/collection_spec.rb
lhs-5.6.0 spec/data/collection_spec.rb
lhs-5.5.0 spec/data/collection_spec.rb
lhs-5.4.2 spec/data/collection_spec.rb