Sha256: 07b406f7a03a944a685b64f3418dc308a78eed2af5733e934c41a82eea163696

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'
module Qrb
  describe TypeFactory, "DSL#seq" do

    let(:factory){ TypeFactory.new }

    shared_examples_for "The Seq[Int] type" do

      it{ should be_a(SeqType) }

      it 'should have the correct element type' do
        subject.elm_type.should eq(intType)
      end
    end

    before do
      subject
    end

    context 'when used with a ruby class' do
      subject{
        factory.seq(Integer)
      }

      it_should_behave_like "The Seq[Int] type"

      it 'should have the correct name' do
        subject.name.should eq("[Integer]")
      end
    end

    context 'when used with a type' do
      subject{
        factory.seq(intType)
      }

      it_should_behave_like "The Seq[Int] type"

      it 'should have the correct name' do
        subject.name.should eq("[intType]")
      end
    end

    context 'when used with an explicit name' do
      subject{
        factory.seq(intType, "MySeq")
      }

      it_should_behave_like "The Seq[Int] type"

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qrb-0.3.0 spec/unit/type_factory/dsl/test_seq.rb
qrb-0.2.0 spec/unit/type_factory/dsl/test_seq.rb
qrb-0.1.0 spec/unit/type_factory/dsl/test_seq.rb