Sha256: 89c952cec40eabd6b4218d455b084c0b148d71f2535a1e4a5fecfa3b33b20436

Contents?: true

Size: 812 Bytes

Versions: 4

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

require 'dry/logic/predicates'

RSpec.describe Dry::Logic::Predicates do
  describe '#type?' do
    let(:predicate_name) { :type? }

    context 'when value has a correct type' do
      let(:arguments_list) do
        [[TrueClass, true]]
      end

      it_behaves_like 'a passing predicate'
    end

    context 'with value is not true' do
      let(:arguments_list) do
        [
          [TrueClass, false],
          [TrueClass, ''],
          [TrueClass, []],
          [TrueClass, {}],
          [TrueClass, nil],
          [TrueClass, :symbol],
          [TrueClass, String],
          [TrueClass, 1],
          [TrueClass, 0],
          [TrueClass, 'true'],
          [TrueClass, 'false']
        ]
      end

      it_behaves_like 'a failing predicate'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-logic-1.0.5 spec/unit/predicates/type_spec.rb
dry-logic-1.0.4 spec/unit/predicates/type_spec.rb
dry-logic-1.0.3 spec/unit/predicates/type_spec.rb
dry-logic-1.0.2 spec/unit/predicates/type_spec.rb