Class: DeprecationToolkit::Behaviors::DeprecationMismatch

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

Instance Method Summary collapse

Constructor Details

#initialize(current_deprecations, recorded_deprecations) ⇒ DeprecationMismatch

Returns a new instance of DeprecationMismatch.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/deprecation_toolkit/behaviors/raise.rb', line 72

def initialize(current_deprecations, recorded_deprecations)
  record_message =
    if DeprecationToolkit::Configuration.test_runner == :rspec
      "You can re-record deprecations by adding 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 = "    The recorded deprecations for this test doesn't match the one that got triggered.\n    Fix or record the new deprecations to discard this error.\n\n    \#{record_message}\n\n    ===== Expected\n    \#{recorded_deprecations.deprecations_without_stacktrace.join(\"\\n\")}\n    ===== Actual\n    \#{current_deprecations.deprecations_without_stacktrace.join(\"\\n\")}\n  EOM\n\n  super(message)\nend\n"