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
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/deprecation.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/deprecation.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/deprecation.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/deprecation.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/deprecation.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/deprecation.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/deprecation.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/deprecation.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-expectations-2.14.5/lib/rspec/expectations/deprecation.rb
dxruby_rp5-0.0.4 spec/vendor/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
rspec-expectations-2.14.5 lib/rspec/expectations/deprecation.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
dxruby_rp5-0.0.3 spec/vendor/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
tuktuk-rails-0.0.9 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
tuktuk-rails-0.0.8 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
tuktuk-rails-0.0.7 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
dxruby_rp5-0.0.2 spec/vendor/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb
dxruby_rp5-0.0.1 spec/vendor/rspec-expectations-2.14.4/lib/rspec/expectations/deprecation.rb