Sha256: 1b7fe64a31336edd3d2782c3a268f5db4a9f61f2aed5abf5e3e05b7fbf2d6fc8

Contents?: true

Size: 1008 Bytes

Versions: 19

Compression:

Stored size: 1008 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)
      @method, @alternate_method = method, alternate_method
    end

    def []=(k,v)
      RSpec.deprecate(@method, @alternate_method)
      super(k,v)
    end

  end

end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
rspec-core-2.7.0.rc1 lib/rspec/core/deprecation.rb
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/deprecation.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/deprecation.rb
rspec-core-2.6.4 lib/rspec/core/deprecation.rb
rspec-core-2.6.3 lib/rspec/core/deprecation.rb
rspec-core-2.6.3.beta1 lib/rspec/core/deprecation.rb
rspec-core-2.6.2.rc lib/rspec/core/deprecation.rb
rspec-core-2.6.0 lib/rspec/core/deprecation.rb
rspec-core-2.6.0.rc6 lib/rspec/core/deprecation.rb
rspec-core-2.5.2 lib/rspec/core/deprecation.rb
rspec-core-2.6.0.rc4 lib/rspec/core/deprecation.rb
rspec-core-2.6.0.rc2 lib/rspec/core/deprecation.rb
rspec-core-2.5.1 lib/rspec/core/deprecation.rb
rspec-core-2.5.0 lib/rspec/core/deprecation.rb
rspec-core-2.4.0 lib/rspec/core/deprecation.rb
rspec-core-2.3.1 lib/rspec/core/deprecation.rb
rspec-core-2.3.0 lib/rspec/core/deprecation.rb
rspec-core-2.2.1 lib/rspec/core/deprecation.rb
rspec-core-2.2.0 lib/rspec/core/deprecation.rb