Sha256: 7ad9fd4708607399366251399bb4995848ef13bf1ed8a3e64d277edba54f2100

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

# frozen_string_literal: true

require 'dry/logic/predicates'

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

  context 'when value matches provided regexp' do
    let(:arguments_list) do
      [[/^F/, 'Foo']]
    end

    it_behaves_like 'a passing predicate'
  end

  context 'when value does not match provided regexp' do
    let(:arguments_list) do
      [[/^F/, 'Bar']]
    end

    it_behaves_like 'a failing predicate'
  end

  context 'when input is nil' do
    let(:arguments_list) do
      [[/^F/, nil]]
    end

    it_behaves_like 'a failing predicate'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-logic-1.0.5 spec/unit/predicates/format_spec.rb