Sha256: c3afc9d98b27d1fa0d9e72d9413a6561e47c825f86652314dc6df7fa70928c73

Contents?: true

Size: 704 Bytes

Versions: 3

Compression:

Stored size: 704 Bytes

Contents

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

3 entries across 3 versions & 1 rubygems

Version Path
qrb-0.3.0 spec/unit/type/tuple_type/test_include.rb
qrb-0.2.0 spec/unit/type/tuple_type/test_include.rb
qrb-0.1.0 spec/unit/type/tuple_type/test_include.rb