Sha256: b0d1ff65ac8db425fe7a6b39c240877fa1c61d873beb28cfd8ce87e115e81b13

Contents?: true

Size: 618 Bytes

Versions: 3

Compression:

Stored size: 618 Bytes

Contents

require 'spec_helper'
module Qrb
  describe SubType, "include?" do

    let(:type){ SubType.new(intType, {default: ->(i){ i>0 }, small: ->(i){ i<255 }}, "byte") }

    subject{ type.include?(arg) }

    context 'when included on int' do
      let(:arg){ 12 }

      it{ should be_true }
    end

    context 'when not included on int (I)' do
      let(:arg){ -12 }

      it{ should be_false }
    end

    context 'when not included on int (II)' do
      let(:arg){ 255 }

      it{ should be_false }
    end

    context 'when not included' do
      let(:arg){ "12" }

      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/sub_type/test_include.rb
qrb-0.2.0 spec/unit/type/sub_type/test_include.rb
qrb-0.1.0 spec/unit/type/sub_type/test_include.rb