Sha256: f4c26cbdc2c8ee17eb0d3f99b275947d82610dc76db0ed67c43cafe9e308e319

Contents?: true

Size: 1016 Bytes

Versions: 24

Compression:

Stored size: 1016 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(k,v)
    end

  end

end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rspec-core-2.1.0/lib/rspec/core/deprecation.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/rspec-core-2.1.0/lib/rspec/core/deprecation.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/rspec-core-2.1.0/lib/rspec/core/deprecation.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/rspec-core-2.1.0/lib/rspec/core/deprecation.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/rspec-core-2.1.0/lib/rspec/core/deprecation.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/rspec-core-2.1.0/lib/rspec/core/deprecation.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/rspec-core-2.1.0/lib/rspec/core/deprecation.rb
rspec-core-2.1.0 lib/rspec/core/deprecation.rb
rspec-core-2.0.1 lib/rspec/core/deprecation.rb
gemrage-1.0.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.4.1 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.4.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.3.2 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.3.1 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.3.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.2.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.1.2 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.1.1 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.1.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb
gemrage-0.0.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/lib/rspec/core/deprecation.rb