Sha256: 05de2d609bf78d44e62d40d966f4b77e27e7e281905e11c7d89a6b143f5d0171

Contents?: true

Size: 1.13 KB

Versions: 5333

Compression:

Stored size: 1.13 KB

Contents

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

5,333 entries across 5,247 versions & 122 rubygems

Version Path
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/matcher_definition.rb
mux_ruby-3.19.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/matcher_definition.rb
moneykit-0.1.15 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb
moneykit-0.1.14 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb
mux_ruby-3.18.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/matcher_definition.rb
moneykit-0.1.13 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb
moneykit-0.1.12 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb
moneykit-0.1.11 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb
mux_ruby-3.17.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/matcher_definition.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.10.2/lib/rspec/support/matcher_definition.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.10.2/lib/rspec/support/matcher_definition.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rspec-support-3.10.2/lib/rspec/support/matcher_definition.rb
moneykit-0.1.10 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb
moneykit-0.1.9 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb
mux_ruby-3.15.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/matcher_definition.rb
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/rspec-support-3.11.0/lib/rspec/support/matcher_definition.rb
mux_ruby-3.14.0 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.11.0/lib/rspec/support/matcher_definition.rb
moneykit-0.1.6 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb
cybrid_api_id_ruby-0.113.118 vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib/rspec/support/matcher_definition.rb