Sha256: 50f70c7e1c33ba39483cde4ed60cd6a7ad6676e8f16eaf68183e099e80916bc9
Contents?: true
Size: 1.38 KB
Versions: 4
Compression:
Stored size: 1.38 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Evaluator::Context, '#add' do let(:attribute) { Attribute::Integer.new(:id) } let(:header) { Relation::Header.new([ attribute ]) } context 'when an aggregate is provided' do subject { described_class.new(header) { |object| object.add(:aggregate, aggregate) } } let(:aggregate) { attribute.sum } its(:functions) { should eql(Attribute::Integer.new(:aggregate) => aggregate) } end context 'when a function is provided' do subject { described_class.new(header) { |object| object.add(:function, function) } } let(:function) { attribute.add(attribute) } its(:functions) { should eql(Attribute::Integer.new(:function) => function) } end context 'when a proc is provided' do subject { described_class.new(header) { |object| object.add(:proc, proc) } } let(:proc) { Proc.new {} } its(:functions) { should eql(Attribute::Object.new(:proc) => proc) } end context 'when a block is provided' do subject { described_class.new(header) { |object| object.add(:block, &block) } } let(:block) { proc {} } its(:functions) { should eql(Attribute::Object.new(:block) => block) } end context 'when a literal is provided' do subject { described_class.new(header) { |object| object.add(:literal, 1) } } its(:functions) { should eql(Attribute::Integer.new(:literal) => 1) } end end
Version data entries
4 entries across 4 versions & 1 rubygems