Sha256: 04d3a8b42c8f68c027fd6bc6a2f85e7d1d4dc101389184f69168efb5af650cf5

Contents?: true

Size: 955 Bytes

Versions: 2

Compression:

Stored size: 955 Bytes

Contents

require 'spec_helper'
module Finitio
  describe TypeFactory, "DSL#attributes" do

    let(:factory){ TypeFactory.new }

    shared_examples_for "The a:Integer, b:Float attributes" do

      it{ should be_a(Array) }

      it 'should be the correct pair' do
        subject.should eq([ Attribute.new(:a, intType), Attribute.new(:b, floatType) ])
      end
    end

    context 'when used with ruby classes' do
      subject{
        factory.attributes(a: Integer, b: Float)
      }

      it_should_behave_like "The a:Integer, b:Float attributes"
    end

    context 'when used with types' do
      subject{
        factory.attributes(a: intType, b: floatType)
      }

      it_should_behave_like "The a:Integer, b:Float attributes"
    end

    context 'when used with a mix of both types' do
      subject{
        factory.attributes(a: Integer, b: floatType)
      }

      it_should_behave_like "The a:Integer, b:Float attributes"
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finitio-0.4.1 spec/unit/type_factory/dsl/test_attributes.rb
finitio-0.4.0 spec/unit/type_factory/dsl/test_attributes.rb