2010-05-04 15:48:59 +00:00
|
|
|
require 'apache/config'
|
|
|
|
|
|
|
|
describe Apache::Config, "should handle the basics of Apache config" do
|
|
|
|
before do
|
|
|
|
Apache::Config.reset!
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should handle indent" do
|
|
|
|
Apache::Config.line_indent = 1
|
|
|
|
|
|
|
|
Apache::Config.indent("hello").should == " hello"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should add a line to the config" do
|
|
|
|
Apache::Config << "hello"
|
|
|
|
Apache::Config.config.should == [ 'hello' ]
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should handle method_missing" do
|
|
|
|
Apache::Config.test "test2", "test3"
|
|
|
|
Apache::Config.test_again! "test2", "test3"
|
|
|
|
|
|
|
|
Apache::Config.config.should == [
|
|
|
|
'Test "test2" "test3"',
|
|
|
|
'TestAgain test2 test3'
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should Apachify the name" do
|
|
|
|
Apache::Config.apachify("test").should == "Test"
|
|
|
|
Apache::Config.apachify("test_full_name").should == "TestFullName"
|
2010-05-05 14:44:20 +00:00
|
|
|
Apache::Config.apachify("ssl_option").should == "SSLOption"
|
2010-05-05 18:43:50 +00:00
|
|
|
Apache::Config.apachify("exec_cgi").should == "ExecCGI"
|
2010-05-06 14:40:45 +00:00
|
|
|
Apache::Config.apachify("authz_ldap_authoritative").should == "AuthzLDAPAuthoritative"
|
|
|
|
Apache::Config.apachify("authz_ldap_url").should == "AuthzLDAPURL"
|
2010-05-04 15:48:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should quoteize properly" do
|
|
|
|
Apache::Config.quoteize("test", "test2").should == %w{"test" "test2"}
|
|
|
|
Apache::Config.quoteize(:test, :test2).should == %w{test test2}
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should blockify a block" do
|
|
|
|
Apache::Config.blockify("Tag", [ 'part', 'part2' ]) do
|
|
|
|
something "goes here"
|
2010-05-06 14:40:45 +00:00
|
|
|
end.should == ['', '<Tag "part" "part2">', ' Something "goes here"', '</Tag>', '']
|
2010-05-04 15:51:06 +00:00
|
|
|
|
|
|
|
Apache::Config.reset!
|
|
|
|
|
|
|
|
Apache::Config.blockify("Tag", 'part') do
|
|
|
|
something "goes here"
|
2010-05-06 14:40:45 +00:00
|
|
|
end.should == ['', '<Tag "part">', ' Something "goes here"', '</Tag>', '']
|
2010-05-04 15:48:59 +00:00
|
|
|
end
|
2010-05-04 21:04:44 +00:00
|
|
|
|
|
|
|
it "should handle a build" do
|
|
|
|
Apache::Config.build do
|
|
|
|
my_test "this"
|
|
|
|
end
|
|
|
|
|
|
|
|
Apache::Config.config.should == [
|
|
|
|
'MyTest "this"'
|
|
|
|
]
|
|
|
|
end
|
2010-05-04 15:48:59 +00:00
|
|
|
end
|