more code coverage

This commit is contained in:
John Bintz 2010-05-07 11:52:34 -04:00
parent 866ccd9f77
commit f5a32427ac
2 changed files with 27 additions and 2 deletions

View File

@ -34,10 +34,10 @@ module Apache
when String
out += c.split("\n")
when Array
out = c
out += c
end
out << ''
self + out.collect { |line| "# #{line.strip}" }
self + out.collect { |line| "# #{line.strip}".strip }
end
def script_alias(uri, path)

View File

@ -27,6 +27,7 @@ describe Apache::Master, "should provide basic helpers for configuration" do
[
[ [ :apache_include, 'test' ], [ 'Include test' ] ],
[ [ :apache_alias, 'test', 'test2' ], [ 'Alias "test" "test2"' ] ],
[ [ :timeout, 300 ], [ 'Timeout 300' ] ]
].each do |call, config|
apache.reset!
apache.send(*call)
@ -38,4 +39,28 @@ describe Apache::Master, "should provide basic helpers for configuration" do
apache.rotate_logs_path = "/my/path"
apache.rotatelogs('/log/path', 12345).should == "|/my/path /log/path 12345"
end
it "should create Passenger directives" do
apache.passenger '/opt/local/ruby', '1.8', '2.2.11'
apache.to_a.should == [
'LoadModule "passenger_module" "/opt/local/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so"',
'PassengerRoot "/opt/local/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.11"',
'PassengerRuby "/opt/local/ruby/bin/ruby"'
]
end
# not testing this big blob for output correctness...
it "should enable gzip server-wide" do
apache.enable_gzip!
end
it "should create Apache comments" do
apache.comment("This is a comment")
apache.to_a.should == [ '#', '# This is a comment', '#' ]
apache.reset!
apache.comment(["This is", "a comment"])
apache.to_a.should == [ '#', '# This is', '# a comment', '#' ]
end
end