Sha256: e15df0897e7d1b946849c6766eac7f1092f4dff35252849734281f745b3155a2

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require_relative "base"

module RSpec
  module Clone
    module ExpectationTarget
      # Wraps the target of an expectation with a block.
      #
      # @example
      #   expect { something } # => ExpectationTarget::Block wrapping something
      #
      #   # used with `to`
      #   expect { actual }.to be(42)
      #
      #   # with `not_to`
      #   expect { actual }.not_to be(4)
      #
      # @note `RSpec::Clone::ExpectationTarget::Block` is not intended to be
      #   instantiated directly by users. Use `expect` instead.
      class Block < Base
        protected

        # @param matcher  [#matches?] The matcher.
        # @param negate   [Boolean]   The assertion is positive or negative.
        #
        # @return (see Base#absolute_requirement)
        #
        # @raise (see Base#absolute_requirement)
        def absolute_requirement(matcher:, negate:)
          super(
            ::TestTube.invoke(matcher:, negate:, &@input),
            matcher:,
            negate:
          )
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
r_spec-clone-1.7.1 lib/r_spec/clone/expectation_target/block.rb