Sha256: 3da7da5a8dfe832ea53a3387d9ed67f5893b36e37a9388923f0e7f87d5898416

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

require 'spec_helper'
module Finitio
  describe TupleType, "include?" do

    let(:heading){
      Heading.new([Attribute.new(:a, intType)])
    }

    let(:type){ TupleType.new(heading) }

    subject{ type.include?(arg) }

    context 'when a valid hash' do
      let(:arg){ {a: 12} }

      it{ should be_true }
    end

    context 'when an invalid hash (too many attributes)' do
      let(:arg){ {a: 12, b: 15} }

      it{ should be_false }
    end

    context 'when an invalid hash (too few attributes)' do
      let(:arg){ {b: 12} }

      it{ should be_false }
    end

    context 'when an invalid hash (wrong type)' do
      let(:arg){ {a: 12.0} }

      it{ should be_false }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finitio-0.4.1 spec/unit/type/tuple_type/test_include.rb
finitio-0.4.0 spec/unit/type/tuple_type/test_include.rb