Sha256: 5497cc31ef9bd0842037f92331e9642d2b87612ea86fa7d5166318be7bbc8763

Contents?: true

Size: 1.44 KB

Versions: 9

Compression:

Stored size: 1.44 KB

Contents

require 'helper'
require 'sshkit'

module SSHKit
  class TestDot < UnitTest

    def setup
      SSHKit.config.output_verbosity = Logger::DEBUG
    end

    def output
      @_output ||= String.new
    end

    def dot
      @_dot ||= SSHKit::Formatter::Dot.new(output)
    end

    def teardown
      remove_instance_variable :@_dot
      remove_instance_variable :@_output
      SSHKit.reset_configuration!
    end

    def test_logging_fatal
      dot << SSHKit::LogMessage.new(Logger::FATAL, "Test")
      assert_equal "", output.strip
    end

    def test_logging_error
      dot << SSHKit::LogMessage.new(Logger::ERROR, "Test")
      assert_equal "", output.strip
    end

    def test_logging_warn
      dot << SSHKit::LogMessage.new(Logger::WARN, "Test")
      assert_equal "", output.strip
    end

    def test_logging_info
      dot << SSHKit::LogMessage.new(Logger::INFO, "Test")
      assert_equal "", output.strip
    end

    def test_logging_debug
      dot << SSHKit::LogMessage.new(Logger::DEBUG, "Test")
      assert_equal "", output.strip
    end

    def test_command_success
      command = SSHKit::Command.new(:ls)
      command.exit_status = 0
      dot << command
      assert_equal "\e[0;32;49m.\e[0m", output.strip
    end

    def test_command_failure
      command = SSHKit::Command.new(:ls, {raise_on_non_zero_exit: false})
      command.exit_status = 1
      dot << command
      assert_equal "\e[0;31;49m.\e[0m", output.strip
    end

  end
end

Version data entries

9 entries across 7 versions & 3 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/sshkit-1.5.1/test/unit/formatters/test_dot.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/sshkit-1.5.1/test/unit/formatters/test_dot.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/sshkit-1.5.1/test/unit/formatters/test_dot.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/sshkit-1.7.1/test/unit/formatters/test_dot.rb
sshkit-1.7.1 test/unit/formatters/test_dot.rb
sshkit-1.7.0 test/unit/formatters/test_dot.rb
sshkit-1.6.1 test/unit/formatters/test_dot.rb
sshkit-1.5.1 test/unit/formatters/test_dot.rb
sshkit-1.5.0 test/unit/formatters/test_dot.rb