Sha256: e16c9cffc698871ea1522f882b1daf5378c1d0498772d04bee84026415e5345e

Contents?: true

Size: 951 Bytes

Versions: 3

Compression:

Stored size: 951 Bytes

Contents

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

3 entries across 3 versions & 1 rubygems

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