more spec coverage
This commit is contained in:
parent
f5a32427ac
commit
533b79a56f
@ -1,11 +1,16 @@
|
|||||||
module Apache
|
module Apache
|
||||||
module Directories
|
module Directories
|
||||||
def options(*opt)
|
def options(*opt)
|
||||||
self << "Options #{apachify(opt) * " "}"
|
create_options_list('Options', *opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
def index_options(*opt)
|
def index_options(*opt)
|
||||||
self << "IndexOptions #{apachify(opt) * " "}"
|
create_options_list('IndexOptions', *opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def create_options_list(tag, *opt)
|
||||||
|
self << "#{tag} #{apachify(opt) * " "}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -42,7 +42,7 @@ module Apache
|
|||||||
|
|
||||||
def script_alias(uri, path)
|
def script_alias(uri, path)
|
||||||
directory? path
|
directory? path
|
||||||
self << %{ScriptAlias "#{uri}" "#{path}"}
|
self << %{ScriptAlias #{quoteize(uri, path) * ' '}}
|
||||||
end
|
end
|
||||||
|
|
||||||
alias :script_alias! :script_alias
|
alias :script_alias! :script_alias
|
||||||
@ -66,7 +66,7 @@ module Apache
|
|||||||
hash.each do |key, value|
|
hash.each do |key, value|
|
||||||
output = "Header set #{quoteize(key)}"
|
output = "Header set #{quoteize(key)}"
|
||||||
case value
|
case value
|
||||||
when String
|
when String, Symbol
|
||||||
output += " #{quoteize(value)}"
|
output += " #{quoteize(value)}"
|
||||||
when Array
|
when Array
|
||||||
output += " #{quoteize(value.first)} #{value.last}"
|
output += " #{quoteize(value.first)} #{value.last}"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
require 'apache/config'
|
require 'apache/config'
|
||||||
|
require 'fileutils'
|
||||||
|
|
||||||
describe Apache::Config, "builds configurations" do
|
describe Apache::Config, "builds configurations" do
|
||||||
let(:apache) { Apache::Config }
|
let(:apache) { Apache::Config }
|
||||||
@ -75,7 +76,9 @@ describe Apache::Config, "builds configurations" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should handle a build" do
|
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
|
end
|
||||||
|
|
||||||
it "should handle building if the environment is correct" do
|
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.comment(["This is", "a comment"])
|
||||||
apache.to_a.should == [ '#', '# This is', '# a comment', '#' ]
|
apache.to_a.should == [ '#', '# This is', '# a comment', '#' ]
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user