Sha256: 6f5ac831320a85cbf2bc3011bec82e591628d9d1e00be227bff51bbe34fa60cb

Contents?: true

Size: 1.1 KB

Versions: 11

Compression:

Stored size: 1.1 KB

Contents

module RSpec

  class << self
    # Used internally to print deprecation warnings
    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

    # Used internally to print deprecation warnings
    def warn_deprecation(message)
      send :warn, message
    end
  end

  # @private
  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

11 entries across 11 versions & 3 rubygems

Version Path
horseman-0.0.4 vendor/ruby/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/deprecation.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/deprecation.rb
horseman-0.0.2 vendor/ruby/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/deprecation.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/deprecation.rb
nutshell-crm-0.0.5 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/deprecation.rb
nutshell-crm-0.0.4 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/deprecation.rb
nutshell-crm-0.0.3 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/deprecation.rb
nutshell-crm-0.0.2 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/deprecation.rb
nutshell-crm-0.0.1 vendor/bundle/gems/rspec-core-2.7.1/lib/rspec/core/deprecation.rb
rspec-core-2.7.1 lib/rspec/core/deprecation.rb
rspec-core-2.7.0 lib/rspec/core/deprecation.rb