Sha256: 6a8145c4e4bd0bd2e24cc591e91afdd4b95a05d7005e408af3e2ad52d9934870

Contents?: true

Size: 895 Bytes

Versions: 34

Compression:

Stored size: 895 Bytes

Contents

module Spec
  module Matchers
    class << self
      attr_accessor :last_matcher, :last_should # :nodoc:
    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

34 entries across 34 versions & 11 rubygems

Version Path
rango-0.0.6 vendor/rspec/lib/spec/matchers/generated_descriptions.rb
rango-0.1.pre vendor/rspec/lib/spec/matchers/generated_descriptions.rb
pupu-0.0.1 vendor/rspec/lib/spec/matchers/generated_descriptions.rb
media-path-0.1 vendor/rspec/lib/spec/matchers/generated_descriptions.rb
simple-templater-0.0.1 vendor/rspec/lib/spec/matchers/generated_descriptions.rb
middleman-0.10.17 vendor/gems/gems/rspec-1.2.9/lib/spec/matchers/generated_descriptions.rb
middleman-0.10.16 vendor/gems/gems/rspec-1.2.9/lib/spec/matchers/generated_descriptions.rb
middleman-0.10.15 vendor/gems/gems/rspec-1.2.9/lib/spec/matchers/generated_descriptions.rb
rackjour-0.1.8 vendor/gems/gems/rspec-1.2.9/lib/spec/matchers/generated_descriptions.rb
middleman-0.10.14 vendor/gems/gems/rspec-1.2.9/lib/spec/matchers/generated_descriptions.rb
ageweke-rspec-1.2.9 lib/spec/matchers/generated_descriptions.rb
rspec-1.2.9 lib/spec/matchers/generated_descriptions.rb
rspec-1.2.7 lib/spec/matchers/generated_descriptions.rb
rspec-1.2.8 lib/spec/matchers/generated_descriptions.rb