Sha256: 4499c98de5469484f7db9f8d03a0f368f761ac9e4973a964247e81f3e7543f8e

Contents?: true

Size: 813 Bytes

Versions: 38

Compression:

Stored size: 813 Bytes

Contents

require 'helper'

module SSHKit

  class TestDeprecationLogger < UnitTest

    def output
      @output ||= String.new
    end

    def logger
      @logger ||= DeprecationLogger.new(output)
    end

    def test_hides_duplicate_deprecation_warnings
      line_number = generate_warning
      generate_warning

      actual_lines = output.lines.to_a

      assert_equal(2, actual_lines.size)
      assert_equal "[Deprecated] Some message\n", actual_lines[0]
      assert_match %r{    \(Called from .*sshkit/test/unit/test_deprecation_logger.rb:#{line_number}:in `generate_warning'\)\n}, actual_lines[1]
    end

    def test_handles_nil_output
      DeprecationLogger.new(nil).log('Some message')
    end

    private

    def generate_warning
      logger.log('Some message')
      __LINE__-1
    end
  end

end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
sshkit-1.22.0 test/unit/test_deprecation_logger.rb
sshkit-1.21.7 test/unit/test_deprecation_logger.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/sshkit-1.21.6/test/unit/test_deprecation_logger.rb
sshkit-1.21.6 test/unit/test_deprecation_logger.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/sshkit-1.21.5/test/unit/test_deprecation_logger.rb
sshkit-1.21.5 test/unit/test_deprecation_logger.rb
sshkit-1.21.4 test/unit/test_deprecation_logger.rb
sshkit-1.21.3 test/unit/test_deprecation_logger.rb
sshkit-1.21.2 test/unit/test_deprecation_logger.rb
sshkit-1.21.1 test/unit/test_deprecation_logger.rb
sshkit-1.21.0 test/unit/test_deprecation_logger.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/sshkit-1.18.2/test/unit/test_deprecation_logger.rb
sshkit-1.20.0 test/unit/test_deprecation_logger.rb
sshkit-1.19.1 test/unit/test_deprecation_logger.rb
sshkit-1.19.0 test/unit/test_deprecation_logger.rb
sshkit-1.18.2 test/unit/test_deprecation_logger.rb
sshkit-1.18.1 test/unit/test_deprecation_logger.rb
sshkit-1.18.0 test/unit/test_deprecation_logger.rb
sshkit-1.17.0 test/unit/test_deprecation_logger.rb
sshkit-1.16.1 test/unit/test_deprecation_logger.rb