class DeprecationToolkit::Behaviors::DeprecationIntroduced

Public Class Methods

new(current_deprecations, recorded_deprecations) click to toggle source
Calls superclass method
# File lib/deprecation_toolkit/behaviors/raise.rb, line 22
      def initialize(current_deprecations, recorded_deprecations)
        introduced_deprecations = current_deprecations - recorded_deprecations
        record_message =
          if DeprecationToolkit::Configuration.test_runner == :rspec
            "You can record deprecations by adding the `DEPRECATION_BEHAVIOR='record'` ENV when running your specs."
          else
            "You can record deprecations by adding the `--record-deprecations` flag when running your tests."
          end

        message = <<~EOM
          You have introduced new deprecations in the codebase. Fix or record them in order to discard this error.
          #{record_message}

          #{introduced_deprecations.join("\n")}
        EOM

        super(message)
      end