Sha256: 57add4d5389a0f2259e648a26c6c7d7e475f2c50a99235dd74bb44d244405b3e

Contents?: true

Size: 1.16 KB

Versions: 1728

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

module RSpec
  module Support
    # @private
    def self.matcher_definitions
      @matcher_definitions ||= []
    end

    # Used internally to break cyclic dependency between mocks, expectations,
    # and support. We don't currently have a consistent implementation of our
    # matchers, though we are considering changing that:
    # https://github.com/rspec/rspec-mocks/issues/513
    #
    # @private
    def self.register_matcher_definition(&block)
      matcher_definitions << block
    end

    # Remove a previously registered matcher. Useful for cleaning up after
    # yourself in specs.
    #
    # @private
    def self.deregister_matcher_definition(&block)
      matcher_definitions.delete(block)
    end

    # @private
    def self.is_a_matcher?(object)
      matcher_definitions.any? { |md| md.call(object) }
    end

    # @api private
    #
    # gives a string representation of an object for use in RSpec descriptions
    def self.rspec_description_for_object(object)
      if RSpec::Support.is_a_matcher?(object) && object.respond_to?(:description)
        object.description
      else
        object
      end
    end
  end
end

Version data entries

1,728 entries across 1,728 versions & 14 rubygems

Version Path
cybrid_api_bank_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_organization_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_id_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_bank_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_organization_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_id_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_id_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_bank_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_organization_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_organization_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_id_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_bank_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
ory-client-1.15.12 vendor/bundle/ruby/3.1.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_bank_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_id_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_organization_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_bank_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_organization_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_id_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb
cybrid_api_id_ruby-0.123.2 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.13.1/lib/rspec/support/matcher_definition.rb