Sha256: fda1bc675678dd17cbaa3995be7c1f7dca7376a0e4ff2687f852c8b0a66a672e

Contents?: true

Size: 814 Bytes

Versions: 23

Compression:

Stored size: 814 Bytes

Contents

module RSpec
  module Expectations
    module Deprecation
     RSPEC_LIBS = %w[
        core
        mocks
        expectations
        matchers
        rails
      ]

      ADDITIONAL_TOP_LEVEL_FILES = %w[ autorun ]

      LIB_REGEX = %r{/lib/rspec/(#{(RSPEC_LIBS + ADDITIONAL_TOP_LEVEL_FILES).join('|')})(\.rb|/)}

      # @private
      #
      # Used internally to print deprecation warnings
      def deprecate(deprecated, options={})
        call_site = caller.find { |line| line !~ LIB_REGEX }

        message = "DEPRECATION: #{deprecated} is deprecated."
        message << " Use #{options[:replacement]} instead." if options[:replacement]
        message << " Called from #{call_site}."
        warn message
      end
    end
  end

  extend(Expectations::Deprecation) unless respond_to?(:deprecate)
end

Version data entries

23 entries across 23 versions & 6 rubygems

Version Path
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
rspec-expectations-2.14.4 lib/rspec/expectations/deprecation.rb
rspec-expectations-2.14.3 lib/rspec/expectations/deprecation.rb