File: predicate.rb

package info (click to toggle)
ruby-dry-logic 1.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 728 kB
  • sloc: ruby: 4,929; makefile: 6
file content (12 lines) | stat: -rw-r--r-- 342 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
# frozen_string_literal: true

require "dry/logic/builder"

# TODO: Merge with {operation}?
RSpec.shared_examples "predicate" do
  before { extend Dry::Logic::Builder }
  let(:predicate) { build(&expression) }
  let(:args) { defined?(input) ? [input] : [] }
  subject { predicate.call(*args).success? }
  it { is_expected.to eq(output) }
end