Sha256: 9d66b8b00df9d23ba77f64933714e52258a771de2f1f3e22ae7669072a3db574

Contents?: true

Size: 721 Bytes

Versions: 3

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

require 'dry/logic/predicates'

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

    context 'when value is a hash' do
      let(:arguments_list) do
        [
          [{}],
          [foo: :bar],
          [Hash.new]
        ]
      end

      it_behaves_like 'a passing predicate'
    end

    context 'when value is not a hash' do
      let(:arguments_list) do
        [
          [''],
          [[]],
          [nil],
          [:symbol],
          [String],
          [1],
          [1.0],
          [true],
          [Array.new],
          [Hash]
        ]
      end

      it_behaves_like 'a failing predicate'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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