Sha256: 7078dc359fb1f78705e876d079ad0b5970f01c3c570895329e13725f565b96ad

Contents?: true

Size: 931 Bytes

Versions: 2

Compression:

Stored size: 931 Bytes

Contents

require 'spec_helper'
module Finitio
  describe TypeFactory, "Factory#set" do

    let(:factory){ TypeFactory.new }

    context 'for set of scalars' do
      let(:expected){ SetType.new(intType) }

      context 'when used with {Class}' do
        subject{ factory.type([Integer].to_set) }

        it{ should eq(expected) }
      end

      context 'when used with [Class] and a name' do
        subject{ factory.type([Integer].to_set, "MySet") }

        it{ should eq(expected) }

        it 'should have the correct name' do
          subject.name.should eq("MySet")
        end
      end
    end

    context 'for pseudo-relations' do
      subject{
        factory.type([{r: Integer}].to_set, "MySet")
      }

      let(:expected){
        factory.relation(r: Integer)
      }

      it{ should eq(expected) }

      it 'should have the correct name' do
        subject.name.should eq("MySet")
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finitio-0.4.1 spec/unit/type_factory/factory/test_set_type.rb
finitio-0.4.0 spec/unit/type_factory/factory/test_set_type.rb