Sha256: 00f0f788ee53f5c29dc5ad42ba1fe4e7f3289e0363920a3fb6be0772683bcd02

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

module Deprecation
  class RSpec
    if defined? ::RSpec and $0 =~ Regexp.union(/rake/, /rspec/)
      require 'rspec/core'

      Deprecation.default_deprecation_behavior = :stderr_report

      ::RSpec.configure do |config|
        config.after(:suite) do
          Deprecation::RSpec.report $stderr
        end
      end
    end

    def self.report io
      return if Deprecation.deprecations.empty?
      io.puts "\n\n==== DEPRECATION WARNINGS ===="
      Deprecation.deprecations.each do |hash, obj|
        io.puts(obj[:message] + " (#{obj[:count]} times); e.g.: ")
        io.puts("    " + obj[:callstack][0..4].join("\n    ") + "\n\n")
      end

      io.puts <<-EOF
      If you need more of the backtrace for any of these deprecations to identify
      where to make the necessary changes, you can configure 
      `Deprecation.default_deprecation_behavior = :raise`, and it will turn the deprecation
      warnings into errors, giving you the full backtrace.
      EOF
      io.puts "\n\n========\n\n"
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/deprecation-1.1.0/lib/deprecation/rspec.rb
deprecation-1.1.0 lib/deprecation/rspec.rb
deprecation-0.99.0 lib/deprecation/rspec.rb
deprecation-1.0.0 lib/deprecation/rspec.rb
deprecation-0.2.2 lib/deprecation/rspec.rb
deprecation-0.2.1 lib/deprecation/rspec.rb
deprecation-0.2.0 lib/deprecation/rspec.rb