Sha256: e08d23c8d542ae7b4a8aae0bc11a94aaca76c9913c8d1ea5c7176ca171d9c8d2

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

require 'spec_helper'
module Alf
  describe TupleExpression, 'evaluate' do

    subject{ exp.evaluate(scope) }

    let(:tuple){ Tuple(name: "Jones") }

    let(:scope){ Support::TupleScope.new(tuple) }

    context 'when the proc is of arity 0' do
      let(:exp){ TupleExpression[->(){ name.upcase }] }

      it{ should eq("JONES") }
    end

    context 'when the proc is of arity 1' do
      let(:exp){ TupleExpression[->(t){ t.name.upcase }] }

      it{ should eq("JONES") }
    end

    context 'when the proc returns a bound expression' do
      let(:exp){ TupleExpression[->(t){ Algebra::Operand::Named.new(:suppliers, examples_database) }] }

      it{ should be_a(Relation) }
    end

  end # TupleExpression
end # Alf

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-types/tuple_expression/test_evaluate.rb