1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/lib/shoulda/matchers/warn.rb

29 lines
652 B
Ruby
Raw Normal View History

module Shoulda
module Matchers
2019-02-16 05:01:35 -05:00
# @private
2014-07-18 20:58:52 -04:00
TERMINAL_MAX_WIDTH = 72
# @private
2014-07-18 20:58:52 -04:00
def self.warn(message)
header = 'Warning from shoulda-matchers:'
divider = '*' * TERMINAL_MAX_WIDTH
wrapped_message = word_wrap(message)
2014-07-18 20:58:52 -04:00
full_message = [
divider,
[header, wrapped_message.strip].join("\n\n"),
divider,
2014-07-18 20:58:52 -04:00
].join("\n")
Kernel.warn(full_message)
end
# @private
def self.warn_about_deprecated_method(old_method, new_method)
warn <<EOT
#{old_method} is deprecated and will be removed in the next major
release. Please use #{new_method} instead.
EOT
end
end
end