test/unit/syslog_output_tests.rb in logsly-1.0.2 vs test/unit/syslog_output_tests.rb in logsly-1.1.0
- old
+ new
@@ -1,36 +1,18 @@
require 'assert'
+require 'logsly/syslog_output'
+
require 'ostruct'
require 'syslog'
require 'logging'
-require 'logsly/settings'
-require 'logsly/syslog_output'
+require 'logsly'
class Logsly::SyslogOutput
- class DataTests < Assert::Context
- desc "the FileOutputData handler"
+ class UnitTests < Assert::Context
+ desc "Logsly::SyslogOutput"
setup do
- @data = Logsly::SyslogOutputData.new {}
- end
- subject { @data }
-
- should have_imeth :identity, :log_opts, :facility
-
- should "default :log_opts" do
- assert_equal (Syslog::LOG_PID | Syslog::LOG_CONS), subject.log_opts
- end
-
- should "default :facility" do
- assert_equal Syslog::LOG_LOCAL0, subject.facility
- end
-
- end
-
- class BaseTests < Assert::Context
- desc "the SyslogOutput handler"
- setup do
@logger = OpenStruct.new
@logger.debug_level = :white
@logger.pattern = '%d : %m\n'
@logger.identity = "whatever"
@logger.facility = Syslog::LOG_LOCAL3
@@ -45,11 +27,11 @@
pattern logger.pattern
colors 'a_color_scheme'
end
end
- subject { @out }
+ subject{ @out }
should "be an output handler" do
assert_kind_of Logsly::BaseOutput, subject
end
@@ -59,8 +41,28 @@
assert_kind_of Logging::Appenders::Syslog, appender
assert_kind_of Logging::Layouts::Pattern, appender.layout
assert_equal '%d : %m\n', appender.layout.pattern
assert_kind_of Logging::ColorScheme, appender.layout.color_scheme
end
+
+ end
+
+ class SyslogOutputDataTests < Assert::Context
+ desc "SyslogOutputData"
+ setup do
+ @data = Logsly::SyslogOutputData.new {}
+ end
+ subject{ @data }
+
+ should have_imeth :identity, :log_opts, :facility
+
+ should "default :log_opts" do
+ assert_equal (Syslog::LOG_PID | Syslog::LOG_CONS), subject.log_opts
+ end
+
+ should "default :facility" do
+ assert_equal Syslog::LOG_LOCAL0, subject.facility
+ end
+
end
end