Sha256: 1b40217b13457f100897de84b898706e10e3117cc87db08538999a43c07278be

Contents?: true

Size: 871 Bytes

Versions: 55

Compression:

Stored size: 871 Bytes

Contents

module RSpec
  module Matchers
    class << self
      attr_accessor :last_matcher, :last_should
    end

    def self.clear_generated_description
      self.last_matcher = nil
      self.last_should = nil
    end

    def self.generated_description
      return nil if last_should.nil?
      "#{last_should.to_s.gsub('_',' ')} #{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 { object.should matcher }

or this:

it { should 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

55 entries across 55 versions & 16 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/lib/rspec/matchers/generated_descriptions.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/lib/rspec/matchers/generated_descriptions.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/lib/rspec/matchers/generated_descriptions.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/matchers/generated_descriptions.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/matchers/generated_descriptions.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/matchers/generated_descriptions.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/matchers/generated_descriptions.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/matchers/generated_descriptions.rb
opal-rspec-cj-0.4.4 vendor_lib/rspec/matchers/generated_descriptions.rb
opal-rspec-0.4.3 vendor_lib/rspec/matchers/generated_descriptions.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-expectations-2.14.5/lib/rspec/matchers/generated_descriptions.rb
opal-rspec-0.4.2 vendor_lib/rspec/matchers/generated_descriptions.rb
opal-rspec-0.4.1 vendor_lib/rspec/matchers/generated_descriptions.rb
opal-rspec-0.4.0 vendor_lib/rspec/matchers/generated_descriptions.rb
opal-rspec-0.4.0.beta4 vendor_lib/rspec/matchers/generated_descriptions.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-expectations-2.13.0/lib/rspec/matchers/generated_descriptions.rb
rspec-expectations-2.99.2 lib/rspec/matchers/generated_descriptions.rb
dxruby_rp5-0.0.4 spec/vendor/rspec-expectations-2.14.4/lib/rspec/matchers/generated_descriptions.rb
rspec-expectations-2.99.1 lib/rspec/matchers/generated_descriptions.rb
rspec-expectations-2.99.0 lib/rspec/matchers/generated_descriptions.rb