Sha256: b65fad80c3faf3b1b399ca0ff9ee049e407bd279b12d288ded2d477070a3ee26

Contents?: true

Size: 757 Bytes

Versions: 52

Compression:

Stored size: 757 Bytes

Contents

require 'rails_helper'

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

  context 'to_ary' do
    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

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

    let(:subject) { collection.to_ary }

    it 'returns an array' do
      expect(subject).to be
      expect(subject).to be_kind_of Array
      expect(subject[0]).to be_kind_of Record
      expect(subject[0].name).to eq 'Steve'
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

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