Sha256: 8171094e7a1398d2b61b7a8a7d676d81c6cb64d1abd90cf37d478a5b35499872

Contents?: true

Size: 927 Bytes

Versions: 3

Compression:

Stored size: 927 Bytes

Contents

require 'spec_helper'
module Qrb
  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

3 entries across 3 versions & 1 rubygems

Version Path
qrb-0.3.0 spec/unit/type_factory/factory/test_set_type.rb
qrb-0.2.0 spec/unit/type_factory/factory/test_set_type.rb
qrb-0.1.0 spec/unit/type_factory/factory/test_set_type.rb