Sha256: 519c3df90b1ccfd1fde90ca1b843d3d8235fb23538ff96f982fc62c0d45618ee

Contents?: true

Size: 969 Bytes

Versions: 5

Compression:

Stored size: 969 Bytes

Contents

module Spec
  class << self
    def deprecate(method, alternate_method=nil)
      return if Spec::Runner.configuration.suppress_deprecation_warnings?
      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

5 entries across 5 versions & 3 rubygems

Version Path
rspec-instructure-1.3.3 lib/spec/deprecation.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-1.3.2/lib/spec/deprecation.rb
rspec-1.3.2 lib/spec/deprecation.rb
rspec-1.3.1 lib/spec/deprecation.rb
rspec-1.3.1.rc lib/spec/deprecation.rb