Class: DeprecationToolkit::Behaviors::DeprecationRemoved

Inherits:
DeprecationException
  • Object
show all
Defined in:
lib/deprecation_toolkit/behaviors/raise.rb

Instance Method Summary collapse

Constructor Details

#initialize(current_deprecations, recorded_deprecations) ⇒ DeprecationRemoved

Returns a new instance of DeprecationRemoved.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/deprecation_toolkit/behaviors/raise.rb', line 43

def initialize(current_deprecations, recorded_deprecations)
  removed_deprecations = recorded_deprecations - current_deprecations

  record_message =
    if DeprecationToolkit::Configuration.test_runner == :rspec
      "You can re-record deprecations by setting the `DEPRECATION_BEHAVIOR='record'` ENV when running your specs."
    else
      "You can re-record deprecations by adding the `--record-deprecations` flag when running your tests."
    end

  message = <<~EOM
    You have removed deprecations from the codebase. Thanks for being an awesome person.
    The recorded deprecations needs to be updated to reflect your changes.
    #{record_message}

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

  super(message)
end