Sha256: a6073ddce88b036ecbce6b5c1d0b5bf36825745a7470d8c4a3d345335ef488fa

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

require 'spec_helper'
module Qrb
  describe Syntax, "relation_type" do

    subject{
      Syntax.parse(input, root: "relation_type")
    }

    let(:compiled){
      subject.compile(type_factory)
    }

    context 'empty heading' do
      let(:input){ '{{ }}' }

      it 'compiles to a RelationType' do
        compiled.should be_a(RelationType)
        compiled.heading.should be_empty
      end
    end

    context '{{a: .Integer}}' do
      let(:input){ '{{a: .Integer}}' }

      it 'compiles to a RelationType' do
        compiled.should be_a(RelationType)
        compiled.heading.size.should eq(1)
      end
    end

    context '{{a: .Integer, b: .Float}}' do
      let(:input){ '{{a: .Integer, b: .Float}}' }

      it 'compiles to a RelationType' do
        compiled.should be_a(RelationType)
        compiled.heading.size.should eq(2)
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qrb-0.2.0 spec/unit/syntax/nodes/test_relation_type.rb
qrb-0.1.0 spec/unit/syntax/nodes/test_relation_type.rb