Sha256: 1fc5eb7f0b93675657d96f2230ef08e8d4ad86276bfca6705831e3d915a9f645

Contents?: true

Size: 779 Bytes

Versions: 31

Compression:

Stored size: 779 Bytes

Contents

shared_examples_for 'materializable relation' do
  describe '#each' do
    it 'yields objects' do
      count = relation.to_a.size
      result = []

      relation.each do |object|
        result << object
      end

      expect(result.count).to eql(count)
    end

    it 'returns enumerator when block is not provided' do
      expect(relation.each.to_a).to eql(relation.to_a)
    end
  end

  describe '#one' do
    it 'returns one tuple' do
      expect(relation.one).to be_instance_of(Hash)
    end
  end

  describe '#first' do
    it 'returns first tuple' do
      expect(relation.first).to be_instance_of(Hash)
    end
  end

  describe '#call' do
    it 'materializes relation' do
      expect(relation.call).to be_instance_of(ROM::Relation::Loaded)
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
rom-2.0.0 spec/shared/materializable.rb
rom-1.0.0 spec/shared/materializable.rb
rom-1.0.0.rc1 spec/shared/materializable.rb
rom-1.0.0.beta2 spec/shared/materializable.rb
rom-1.0.0.beta1 spec/shared/materializable.rb
rom-0.9.1 spec/shared/materializable.rb
rom-0.9.0 spec/shared/materializable.rb
rom-0.9.0.rc1 spec/shared/materializable.rb
rom-0.9.0.beta1 spec/shared/materializable.rb
rom-0.8.1 spec/shared/materializable.rb
rom-0.8.0 spec/shared/materializable.rb