Sha256: e3b08ba928141604ed921003aa76a987cb139e9f38907d1948a081d448bf4c3f

Contents?: true

Size: 797 Bytes

Versions: 8

Compression:

Stored size: 797 Bytes

Contents

require 'dry/logic/predicates'

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

    context 'when value is an array' do
      let(:arguments_list) do
        [
          [ [] ],
          [ ['other', 'array'] ],
          [ [123, 'really', :blah] ],
          [ Array.new ],
          [ [nil] ],
          [ [false] ],
          [ [true] ]
        ]
      end

      it_behaves_like 'a passing predicate'
    end

    context 'when value is not an array' do
      let(:arguments_list) do
        [
          [''],
          [{}],
          [nil],
          [:symbol],
          [String],
          [1],
          [1.0],
          [true],
          [Hash.new]
        ]
      end

      it_behaves_like 'a failing predicate'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dry-logic-1.0.0 spec/unit/predicates/array_spec.rb
dry-logic-0.6.1 spec/unit/predicates/array_spec.rb
dry-logic-0.6.0 spec/unit/predicates/array_spec.rb
dry-logic-0.5.0 spec/unit/predicates/array_spec.rb
dry-logic-0.4.2 spec/unit/predicates/array_spec.rb
dry-logic-0.4.1 spec/unit/predicates/array_spec.rb
dry-logic-0.4.0 spec/unit/predicates/array_spec.rb
dry-logic-0.3.0 spec/unit/predicates/array_spec.rb