Sha256: 97da4dc14f0ecb94d54b921d8f5b5cbf4d3ebeec6421afcfdb9f81aacefa0f8e

Contents?: true

Size: 984 Bytes

Versions: 5

Compression:

Stored size: 984 Bytes

Contents

module Rspec
  module Core
  
    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)
        Rspec.deprecate(@method, @alternate_method)
        super
      end
    
    end
  
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-core-2.0.0.a5 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.a4 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.a3 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.a2 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.a1 lib/rspec/core/deprecation.rb