Sha256: 8cf8eeadcf250ceb221296fe8f7db1480216ab5148945e3e67121f629bf9efa9
Contents?: true
Size: 1.08 KB
Versions: 7
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true RSpec.describe MetalArchives::Collection do it 'iterates' do l = lambda do @i ||= 0 next [] if @i >= 100 items = (@i .. (@i + 9)).to_a @i += 10 items end c = MetalArchives::Collection.new l i = 0 c.each do |item| expect(item).to eq i i += 1 end end it 'returns' do l = lambda do @i ||= 0 raise StandardError if @i >= 100 items = (@i .. (@i + 9)).to_a @i += 10 items end c = MetalArchives::Collection.new l i = 0 c.each do |item| break if i == 99 expect(item).to eq i i += 1 end expect(i).to eq 99 end describe 'empty?' do it 'is not empty' do l = lambda do @i ||= 0 next [] if @i >= 100 items = (@i .. (@i + 9)).to_a @i += 10 items end c = MetalArchives::Collection.new l i = 0 expect(c).not_to be_empty end it 'is empty' do c = MetalArchives::Collection.new -> { [] } expect(c).to be_empty end end end
Version data entries
7 entries across 7 versions & 1 rubygems