Sha256: d0d71a5e8a7a352fb67325a65281f8ce73f75d40ad41fc595e70aa8cdbd8bcfe

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
module Alf
  module Relvar
    describe Base, 'OO relational language' do

      let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
      let(:rv)  { Base.new(expr)                                }

      shared_examples_for "the result of a query operator" do
        it 'is a relation variable' do
          subject.should be_a(Relvar)
        end

        it 'is a virtual relation variable' do
          subject.should be_a(Relvar::Virtual)
        end

        it 'should have the initial expression as projection operand' do
          subject.expr.operand.should be(expr)
        end
      end

      context 'on project' do
        subject{ rv.project([:sid]) }

        it_should_behave_like "the result of a query operator"

        it 'should have a projection expression' do
          subject.expr.should be_a(Algebra::Project)
        end
      end

      context 'on allbut' do
        subject{ rv.allbut([:sid]) }

        it_should_behave_like "the result of a query operator"

        it 'should have an allbut expression' do
          subject.expr.should be_a(Algebra::Allbut)
        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-relvar/base/test_oo_lang.rb