logging spec

This commit is contained in:
John Bintz 2010-05-07 14:09:57 -04:00
parent 533b79a56f
commit 378cd7ce29
2 changed files with 26 additions and 1 deletions

View File

@ -3,7 +3,7 @@ module Apache
[ :custom, :error, :script, :rewrite ].each do |type|
class_eval <<-EOT
def #{type}_log(*opts)
handle_log '#{type.to_s.capitalize}Log', opts.first, opts.first, opts[1..-1]
handle_log '#{type.to_s.capitalize}Log', opts.first, quoteize(opts.first), opts[1..-1]
end
def rotate_#{type}_log(*opts)

25
spec/logging_spec.rb Normal file
View File

@ -0,0 +1,25 @@
require 'spec_helper'
describe Apache::Config, "logging directives" do
let(:apache) { Apache::Config }
before { apache.reset! }
it "should handle a defined log type" do
apache.rotate_logs_path = '/path/to/rotatelogs'
[ :custom, :error, :script, :rewrite ].each do |type|
apache.reset!
apache.send("#{type}_log".to_sym, 'test', 'test2')
apache.to_a.should == [ %{#{type.to_s.capitalize}Log "test" test2} ]
apache.reset!
apache.send("rotate_#{type}_log".to_sym, 'test', 86400, 'test2')
apache.to_a.should == [ %{#{type.to_s.capitalize}Log "|/path/to/rotatelogs test 86400" test2} ]
end
end
it "should give log formats" do
apache.combined_log_format
apache.common_log_format
end
end