Sha256: 8a100536f6c05fe1b2313c987458db28c05938f23c8fe1a72d66e0431f9b76ff

Contents?: true

Size: 989 Bytes

Versions: 19

Compression:

Stored size: 989 Bytes

Contents

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

    let(:factory){ TypeFactory.new }

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

    context 'when use with {r: Integer}' do
      subject{ factory.type(r: Integer) }

      it{ should eq(expected) }
    end

    context 'when use with {r: Integer} and a name' do
      subject{ factory.type({r: Integer}, "MyTuple") }

      it{ should eq(expected) }

      it 'should have the correct name' do
        expect(subject.name).to eq("MyTuple")
      end
    end

    context 'when use with {r: 0..255} and a name' do
      subject{ factory.type({r: 0..255}, "MyTuple") }

      it{ should be_a(TupleType) }

      it 'should have the correct constraint on r' do
        subject.dress(r: 36)
        expect{
          subject.dress(r: 543)
        }.to raise_error(TypeError)
      end

      it 'should have the correct name' do
        expect(subject.name).to eq("MyTuple")
      end
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

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