Sha256: b05e517ad99cd1b879fbac712fa241bb149266bd5dc2b09ec6807fa80338cc17

Contents?: true

Size: 910 Bytes

Versions: 4

Compression:

Stored size: 910 Bytes

Contents

module Spec
  class << self
    def deprecate(method, alternate_method=nil)
       message = <<-NOTICE

*****************************************************************
DEPRECATION WARNING: you are using deprecated behaviour that will
be removed from a future version of RSpec.

#{caller(0)[2]}

* #{method} is deprecated.
NOTICE
      if alternate_method
        message << <<-ADDITIONAL
* please use #{alternate_method} instead.
ADDITIONAL
      end
      
      message << "*****************************************************************"
      warn(message)
    end
    
    def warn(message)
      Kernel.warn(message)
    end
    
  end

  class HashWithDeprecationNotice < Hash
    def initialize(method, alternate_method=nil, &block)
      @method, @alternate_method = method, alternate_method
    end
    def []=(k,v)
      Spec.deprecate(@method, @alternate_method)
      super
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-1.2.3 lib/spec/deprecation.rb
rspec-1.2.4 lib/spec/deprecation.rb
rspec-1.2.5 lib/spec/deprecation.rb
rspec-1.2.6 lib/spec/deprecation.rb