Sha256: fbed32ffee3fe74dc9ed8f35d7b8799fc922f148a33c6d71125783b26e5c5cef

Contents?: true

Size: 620 Bytes

Versions: 20

Compression:

Stored size: 620 Bytes

Contents

require 'spec_helper'

RSpec.describe RecordCollection::Base do

  describe '#ids' do
    it 'returns the ids of the collection' do
      employee = Employee.create name: 'E1', section: 'ABC', admin: true, vegan: false
      described_class.new([employee]).ids.should eq [employee.id]
    end

    it 'Filters out nil records' do
      employee = Employee.create name: 'E1', section: 'ABC', admin: true, vegan: false
      described_class.new([employee, nil]).ids.should eq [employee.id]
    end

    it 'returns an empty array for an empty collection' do
      described_class.new.ids.should be_empty
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
record_collection-0.10.4 spec/base/accessors_spec.rb
record_collection-0.10.3 spec/base/accessors_spec.rb
record_collection-0.10.2 spec/base/accessors_spec.rb
record_collection-0.10.1 spec/base/accessors_spec.rb
record_collection-0.10.0 spec/base/accessors_spec.rb
record_collection-0.9.2 spec/base/accessors_spec.rb
record_collection-0.9.1 spec/base/accessors_spec.rb
record_collection-0.9.0 spec/base/accessors_spec.rb
record_collection-0.8.3 spec/base/accessors_spec.rb
record_collection-0.8.2 spec/base/accessors_spec.rb
record_collection-0.8.1 spec/base/accessors_spec.rb
record_collection-0.7.5 spec/base/accessors_spec.rb
record_collection-0.7.4 spec/base/accessors_spec.rb
record_collection-0.7.3 spec/base/accessors_spec.rb
record_collection-0.7.2 spec/base/accessors_spec.rb
record_collection-0.7.1 spec/base/accessors_spec.rb
record_collection-0.7.0 spec/base/accessors_spec.rb
record_collection-0.6.1 spec/base/accessors_spec.rb
record_collection-0.6.0 spec/base/accessors_spec.rb
record_collection-0.5.3 spec/base/accessors_spec.rb