Sha256: cab52d72e4605bdfc7a4871189df122b8650adfe192268f2be4eb29e6afa0978

Contents?: true

Size: 1.17 KB

Versions: 7187

Compression:

Stored size: 1.17 KB

Contents

module RSpec
  module Matchers
    class << self
      # @private
      attr_accessor :last_matcher, :last_expectation_handler
    end

    # @api private
    # Used by rspec-core to clear the state used to generate
    # descriptions after an example.
    def self.clear_generated_description
      self.last_matcher = nil
      self.last_expectation_handler = nil
    end

    # @api private
    # Generates an an example description based on the last expectation.
    # Used by rspec-core's one-liner syntax.
    def self.generated_description
      return nil if last_expectation_handler.nil?
      "#{last_expectation_handler.verb} #{last_description}"
    end

    # @private
    def self.last_description
      last_matcher.respond_to?(:description) ? last_matcher.description : <<-MESSAGE
When you call a matcher in an example without a String, like this:

specify { expect(object).to matcher }

or this:

it { is_expected.to matcher }

RSpec expects the matcher to have a #description method. You should either
add a String to the example this matcher is being used in, or give it a
description method. Then you won't have to suffer this lengthy warning again.
MESSAGE
    end
  end
end

Version data entries

7,187 entries across 7,118 versions & 85 rubygems

Version Path
cybrid_api_organization_ruby-0.123.118 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_bank_ruby-0.123.117 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_id_ruby-0.123.117 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_organization_ruby-0.123.117 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_bank_ruby-0.123.116 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_organization_ruby-0.123.116 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_id_ruby-0.123.116 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rspec-expectations-3.13.1/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_bank_ruby-0.123.115 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_id_ruby-0.123.115 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_organization_ruby-0.123.115 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
ory-client-1.15.17 vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_bank_ruby-0.123.114 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_organization_ruby-0.123.114 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_id_ruby-0.123.114 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_organization_ruby-0.123.113 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_bank_ruby-0.123.113 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_id_ruby-0.123.113 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_organization_ruby-0.123.112 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb
cybrid_api_bank_ruby-0.123.112 vendor/bundle/ruby/3.3.0/gems/rspec-expectations-3.13.3/lib/rspec/matchers/generated_descriptions.rb