spec/syslogger_spec.rb in syslogger-1.2.4 vs spec/syslogger_spec.rb in syslogger-1.2.5
- old
+ new
@@ -17,9 +17,33 @@
%w{debug info warn error fatal unknown}.each do |logger_method|
it "should respond to the #{logger_method.inspect} method" do
Syslogger.new.should respond_to logger_method.to_sym
end
+
+ it "should log #{logger_method} without raising an exception if called with a block" do
+ logger = Syslogger.new
+ Syslog.stub!(:open).and_yield(syslog=mock("syslog", :mask= => true))
+ severity = Syslogger::MAPPING[Logger.const_get(logger_method.upcase)]
+ syslog.should_receive(:log).with(severity, "Some message that doesn't need to be in a block")
+ lambda {
+ logger.send(logger_method.to_sym) { "Some message that doesn't need to be in a block" }
+ }.should_not raise_error
+ end
+
+ it "should log #{logger_method} without raising an exception if called with a nil message" do
+ logger = Syslogger.new
+ lambda {
+ logger.send(logger_method.to_sym, nil)
+ }.should_not raise_error
+ end
+
+ it "should log #{logger_method} without raising an exception if called with a no message" do
+ logger = Syslogger.new
+ lambda {
+ logger.send(logger_method.to_sym)
+ }.should_not raise_error
+ end
end
it "should respond to <<" do
logger = Syslogger.new("my_app", Syslog::LOG_PID, Syslog::LOG_USER)
logger.should respond_to(:<<)