Sha256: cf5cd1c8490e8396f406b76f4eb42e8fe47f480add45fb75b53e4963fd88729f

Contents?: true

Size: 887 Bytes

Versions: 9

Compression:

Stored size: 887 Bytes

Contents

require 'spec_helper'
module Finitio
  describe AdType, 'initialize' do


    subject{
      AdType.new(Color, [rgb_contract, hex_contract])
    }

    context 'with valid arguments' do
      it{ should be_a(AdType) }

      it 'should set the instance variables' do
        expect(subject.ruby_type).to be(Color)
        expect(subject.contracts).to be_a(Array)
      end
    end

    context 'with invalid arguments (I)' do
      subject{ AdType.new("foo", {}) }

      it 'should raise an error' do
        expect{
          subject
        }.to raise_error(ArgumentError, 'Module expected, got `foo`')
      end
    end

    context 'with invalid arguments (II)' do
      subject{ AdType.new(Object, "bar") }

      it 'should raise an error' do
        expect{
          subject
        }.to raise_error(ArgumentError, '[Contract] expected, got `bar`')
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
finitio-0.12.0 spec/type/ad_type/test_initialize.rb
finitio-0.11.4 spec/type/ad_type/test_initialize.rb
finitio-0.11.3 spec/type/ad_type/test_initialize.rb
finitio-0.11.2 spec/type/ad_type/test_initialize.rb
finitio-0.11.1 spec/type/ad_type/test_initialize.rb
finitio-0.10.0 spec/type/ad_type/test_initialize.rb
finitio-0.9.1 spec/type/ad_type/test_initialize.rb
finitio-0.9.0 spec/type/ad_type/test_initialize.rb
finitio-0.8.0 spec/type/ad_type/test_initialize.rb