apache-config-generator/spec/config_spec.rb

61 lines
1.5 KiB
Ruby
Raw Normal View History

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"
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"
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"
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