From f5a32427ac8454cc743f75357ebfef9e53302ad4 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 7 May 2010 11:52:34 -0400 Subject: [PATCH] more code coverage --- lib/apache/master.rb | 4 ++-- spec/master_spec.rb | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/lib/apache/master.rb b/lib/apache/master.rb index b5d0841..cd46b7d 100644 --- a/lib/apache/master.rb +++ b/lib/apache/master.rb @@ -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) diff --git a/spec/master_spec.rb b/spec/master_spec.rb index 675f7c8..2c03ec9 100644 --- a/spec/master_spec.rb +++ b/spec/master_spec.rb @@ -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