Sha256: 535a6ec513d321d7bc2109e38d1f928835674c0ad35acab66146d5741a59503b

Contents?: true

Size: 652 Bytes

Versions: 13

Compression:

Stored size: 652 Bytes

Contents

module Shoulda
  module Matchers
    # @private
    TERMINAL_MAX_WIDTH = 72

    # @private
    def self.warn(message)
      header = 'Warning from shoulda-matchers:'
      divider = '*' * TERMINAL_MAX_WIDTH
      wrapped_message = word_wrap(message)
      full_message = [
        divider,
        [header, wrapped_message.strip].join("\n\n"),
        divider,
      ].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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
shoulda-matchers-6.4.0 lib/shoulda/matchers/warn.rb
shoulda-matchers-6.3.1 lib/shoulda/matchers/warn.rb
shoulda-matchers-6.3.0 lib/shoulda/matchers/warn.rb
shoulda-matchers-6.2.0 lib/shoulda/matchers/warn.rb
shoulda-matchers-6.1.0 lib/shoulda/matchers/warn.rb
shoulda-matchers-6.0.0 lib/shoulda/matchers/warn.rb
shoulda-matchers-5.3.0 lib/shoulda/matchers/warn.rb
shoulda-matchers-5.2.0 lib/shoulda/matchers/warn.rb
shoulda-matchers-5.1.0 lib/shoulda/matchers/warn.rb
shoulda-matchers-5.0.0 lib/shoulda/matchers/warn.rb
shoulda-matchers-5.0.0.rc1 lib/shoulda/matchers/warn.rb
shoulda-matchers-4.5.1 lib/shoulda/matchers/warn.rb
shoulda-matchers-4.5.0 lib/shoulda/matchers/warn.rb