Sha256: 8fb34c73e47e6e0ec62d11c0a8c7d2501568a13e29debf73fb11cbaa76ac00c9
Contents?: true
Size: 927 Bytes
Versions: 15
Compression:
Stored size: 927 Bytes
Contents
# frozen_string_literal: true require "rspec/rails/matchers/base_matcher" module Katalyst module Kpop module Matchers # @api private class ChainedMatcher < RSpec::Rails::Matchers::BaseMatcher Input = Struct.new(:matched) delegate :failure_message, :failure_message_when_negated, to: :@matcher def initialize(*matchers) super() matchers.each { |m| self << m } end def <<(matcher) matcher = matcher.new if matcher.is_a?(Class) (@matchers ||= []) << matcher self end def match(_, actual) @matcher = Input.new(actual) @matchers.all? do |matcher| input = @matcher.matched @matcher = matcher matcher.matches?(input) end end def description @matchers.last.description end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems