more spec coverage
This commit is contained in:
parent
f5a32427ac
commit
533b79a56f
@ -1,11 +1,16 @@
|
||||
module Apache
|
||||
module Directories
|
||||
def options(*opt)
|
||||
self << "Options #{apachify(opt) * " "}"
|
||||
create_options_list('Options', *opt)
|
||||
end
|
||||
|
||||
def index_options(*opt)
|
||||
self << "IndexOptions #{apachify(opt) * " "}"
|
||||
create_options_list('IndexOptions', *opt)
|
||||
end
|
||||
|
||||
private
|
||||
def create_options_list(tag, *opt)
|
||||
self << "#{tag} #{apachify(opt) * " "}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -42,7 +42,7 @@ module Apache
|
||||
|
||||
def script_alias(uri, path)
|
||||
directory? path
|
||||
self << %{ScriptAlias "#{uri}" "#{path}"}
|
||||
self << %{ScriptAlias #{quoteize(uri, path) * ' '}}
|
||||
end
|
||||
|
||||
alias :script_alias! :script_alias
|
||||
@ -66,7 +66,7 @@ module Apache
|
||||
hash.each do |key, value|
|
||||
output = "Header set #{quoteize(key)}"
|
||||
case value
|
||||
when String
|
||||
when String, Symbol
|
||||
output += " #{quoteize(value)}"
|
||||
when Array
|
||||
output += " #{quoteize(value.first)} #{value.last}"
|
||||
|
@ -1,4 +1,5 @@
|
||||
require 'apache/config'
|
||||
require 'fileutils'
|
||||
|
||||
describe Apache::Config, "builds configurations" do
|
||||
let(:apache) { Apache::Config }
|
||||
@ -75,7 +76,9 @@ describe Apache::Config, "builds configurations" do
|
||||
end
|
||||
|
||||
it "should handle a build" do
|
||||
apache.build { my_test "this" }.should == [ 'MyTest "this"' ]
|
||||
FileUtils.mkdir_p 'test'
|
||||
apache.build('test/fake.conf') { my_test "this" }.should == [ 'MyTest "this"' ]
|
||||
FileUtils.rm 'test/fake.conf'
|
||||
end
|
||||
|
||||
it "should handle building if the environment is correct" do
|
||||
|
15
spec/directory_spec.rb
Normal file
15
spec/directory_spec.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require 'apache/config'
|
||||
|
||||
describe Apache::Master, "should provide basic helpers for configuration" do
|
||||
let(:apache) { Apache::Config }
|
||||
|
||||
before { apache.reset! }
|
||||
|
||||
it "should create the list of options" do
|
||||
{ :options => 'Options', :index_options => 'IndexOptions' }.each do |method, tag|
|
||||
apache.reset!
|
||||
apache.send(method, :test, 'test2')
|
||||
apache.to_a.should == [ "#{tag} Test Test2" ]
|
||||
end
|
||||
end
|
||||
end
|
@ -63,4 +63,22 @@ describe Apache::Master, "should provide basic helpers for configuration" do
|
||||
apache.comment(["This is", "a comment"])
|
||||
apache.to_a.should == [ '#', '# This is', '# a comment', '#' ]
|
||||
end
|
||||
|
||||
it "should create & check a script alias" do
|
||||
dir = File.dirname(__FILE__)
|
||||
|
||||
apache.script_alias '/script/', dir
|
||||
apache.to_a.should == [ %{ScriptAlias "/script/" "#{dir}"} ]
|
||||
end
|
||||
|
||||
it "should add a type with some other options" do
|
||||
apache.add_type! 'text/html', '.html', :handler => 'html-handler'
|
||||
apache.to_a.should == [ 'AddType text/html .html', 'AddHandler html-handler .html' ]
|
||||
end
|
||||
|
||||
it "should create headers" do
|
||||
apache.set_header :test => :test2
|
||||
apache.set_header 'test3' => [ 'test4', "test5=test6" ]
|
||||
apache.to_a.should == [ 'Header set test test2', 'Header set "test3" "test4" test5=test6' ]
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user