Sha256: c6c9bdedaf7f7127c99e14ac813b78486e920dff5fad43a6b5809399cf2bbe35

Contents?: true

Size: 886 Bytes

Versions: 196

Compression:

Stored size: 886 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

196 entries across 95 versions & 14 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/rspec-expectations-2.9.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.5 vendor/bundle/gems/rspec-expectations-2.10.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.5 vendor/bundle/gems/rspec-expectations-2.9.1/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.4 vendor/bundle/gems/rspec-expectations-2.10.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.4 vendor/bundle/gems/rspec-expectations-2.9.1/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.4 vendor/bundle/gems/rspec-expectations-2.9.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.3 vendor/bundle/gems/rspec-expectations-2.10.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.3 vendor/bundle/gems/rspec-expectations-2.9.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.3 vendor/bundle/gems/rspec-expectations-2.9.1/lib/rspec/matchers/generated_descriptions.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-expectations-2.11.3/lib/rspec/matchers/generated_descriptions.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/rspec-expectations-2.11.3/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.2 vendor/bundle/gems/rspec-expectations-2.10.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.2 vendor/bundle/gems/rspec-expectations-2.9.1/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.2 vendor/bundle/gems/rspec-expectations-2.9.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.1 vendor/bundle/gems/rspec-expectations-2.10.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.1 vendor/bundle/gems/rspec-expectations-2.9.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.1 vendor/bundle/gems/rspec-expectations-2.9.1/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.0 vendor/bundle/gems/rspec-expectations-2.10.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.0 vendor/bundle/gems/rspec-expectations-2.9.0/lib/rspec/matchers/generated_descriptions.rb
classiccms-0.7.0 vendor/bundle/gems/rspec-expectations-2.9.1/lib/rspec/matchers/generated_descriptions.rb