Sha256: 536bdac936b6e3a08cab72b95766e0c0dbb2168997e27e6744c2973726f51b5c
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Algebra::Restriction, '#each' do subject { object.each { |tuple| yields << tuple } } let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ]) } let(:object) { described_class.new(relation, predicate) } let(:yields) { [] } context 'when predicate is a Proc' do let(:predicate) { proc { true } } it_should_behave_like 'an #each method' it 'yields each tuple' do expect { subject }.to change { yields.dup }. from([]). to([ [ 1 ] ]) end end context 'when predicate is a Function' do let(:predicate) { Function::Proposition::Tautology.instance } it_should_behave_like 'an #each method' it 'yields each tuple' do expect { subject }.to change { yields.dup }. from([]). to([ [ 1 ] ]) end end context 'when predicate is a value' do let(:predicate) { true } it_should_behave_like 'an #each method' it 'yields each tuple' do expect { subject }.to change { yields.dup }. from([]). to([ [ 1 ] ]) end end end
Version data entries
4 entries across 4 versions & 1 rubygems