Sha256: cbce2d6223010b5b978413b07bfd68e92d940d5cfe604b543d50132f09a2e634

Contents?: true

Size: 1.11 KB

Versions: 19

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'
module Finitio
  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
        expect(subject.elm_type).to 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
        expect(subject.name).to 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
        expect(subject.name).to 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
        expect(subject.name).to eq("MySeq")
      end
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
finitio-0.12.0 spec/type_factory/dsl/test_seq.rb
finitio-0.11.4 spec/type_factory/dsl/test_seq.rb
finitio-0.11.3 spec/type_factory/dsl/test_seq.rb
finitio-0.11.2 spec/type_factory/dsl/test_seq.rb
finitio-0.11.1 spec/type_factory/dsl/test_seq.rb
finitio-0.10.0 spec/type_factory/dsl/test_seq.rb
finitio-0.9.1 spec/type_factory/dsl/test_seq.rb
finitio-0.9.0 spec/type_factory/dsl/test_seq.rb
finitio-0.8.0 spec/type_factory/dsl/test_seq.rb
finitio-0.7.0 spec/type_factory/dsl/test_seq.rb
finitio-0.7.0.pre.rc4 spec/type_factory/dsl/test_seq.rb
finitio-0.7.0.pre.rc3 spec/type_factory/dsl/test_seq.rb
finitio-0.7.0.pre.rc2 spec/type_factory/dsl/test_seq.rb
finitio-0.7.0.pre.rc1 spec/type_factory/dsl/test_seq.rb
finitio-0.6.1 spec/type_factory/dsl/test_seq.rb
finitio-0.6.0 spec/type_factory/dsl/test_seq.rb
finitio-0.5.2 spec/type_factory/dsl/test_seq.rb
finitio-0.5.1 spec/type_factory/dsl/test_seq.rb
finitio-0.5.0 spec/type_factory/dsl/test_seq.rb