Sha256: 0000279e5238a3bf94fb2ee733ba4da72b7e5896a63a661df8fe092809e5e0d9

Contents?: true

Size: 1022 Bytes

Versions: 8

Compression:

Stored size: 1022 Bytes

Contents

module RSpec
  
  class << self
    def deprecate(method, alternate_method=nil, version=nil)
      version_string = version ? "rspec-#{version}" : "a future version of RSpec" 

      message = <<-NOTICE

*****************************************************************
DEPRECATION WARNING: you are using deprecated behaviour that will
be removed from #{version_string}.

#{caller(0)[2]}

* #{method} is deprecated.
NOTICE
      if alternate_method
        message << <<-ADDITIONAL
* please use #{alternate_method} instead.
ADDITIONAL
      end

      message << "*****************************************************************"
      warn_deprecation(message)
    end

    def warn_deprecation(message)
      send :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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rspec-core-2.0.0.beta.17 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.beta.16 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.beta.15 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.beta.14 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.beta.13 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.beta.12 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.beta.11 lib/rspec/core/deprecation.rb
rspec-core-2.0.0.beta.10 lib/rspec/core/deprecation.rb