Sha256: c5dd12bfc13d13a3985f39b0496a39a009988a977a17cb0fd63048cb8d6c2b0d

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

require 'spec_helper'
module Alf
  module Algebra
    module Operand
      describe Named, "type_check" do

        subject{ operand.type_check }

        def knows?(name)
          name == :foo
        end

        def heading(name)
          :"#{name}_heading"
        end

        context 'when known' do
          let(:operand){ Named.new(:foo, self) }

          it 'returns the heading' do
            subject.should eq(:foo_heading)
          end
        end

        context 'when unknown' do
          let(:operand){ Named.new(:bar, self) }

          it 'raises a TypeCheckError' do
            lambda{
              subject
            }.should raise_error(TypeCheckError, /No such relvar `bar`/)
          end
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-algebra/operand/named/test_type_check.rb