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