Sha256: 20619ada712edb906a4030a97402a1e1e164c48ebeeec69b647ce81d401e062c

Contents?: true

Size: 813 Bytes

Versions: 4

Compression:

Stored size: 813 Bytes

Contents

require 'spec_helper'
module Alf
  module Engine
    describe InferHeading, 'heading' do

      let(:ih){ InferHeading.new([]) }

      subject{ ih.send(:heading, tuple) }

      context 'on a single tuple' do
        let(:tuple){ {id: 1, name: "Jones"} }

        it{ should eq(Heading.new(id: Fixnum, name: String)) }
      end

      context 'on a tuple with tuple-valued attribute' do
        let(:tuple){ {id: 1, hobby: Tuple(name: "Programming")} }

        it{ should eq(Heading.new(id: Fixnum, hobby: Tuple[name: String])) }
      end

      context 'on a tuple with relation-valued attribute' do
        let(:tuple){ {id: 1, hobby: Relation(name: "Programming")} }

        it{ should eq(Heading.new(id: Fixnum, hobby: Relation[name: String])) }
      end

    end
  end # module Engine
end # module Alf

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-engine/infer_heading/test_heading.rb
alf-core-0.14.0 spec/unit/alf-engine/infer_heading/test_heading.rb
alf-core-0.13.1 spec/unit/alf-engine/infer_heading/test_heading.rb
alf-core-0.13.0 spec/unit/alf-engine/infer_heading/test_heading.rb