Permalink
Browse files

Added test for config installer.

  • Loading branch information...
1 parent 2e075ef commit 34bc64a81117b9f6c062f986d8b2a6edd4bd394d @alloy alloy committed Jun 9, 2008
Showing with 27 additions and 1 deletion.
  1. +2 −0 .gitignore
  2. +1 −1 config_installer.rb
  3. +24 −0 test/config_installer_test.rb
View
@@ -1,2 +1,4 @@
+build
+.DS_Store
Passenger.xcodeproj/*.mode1v3
Passenger.xcodeproj/*.pbxuser
View
@@ -4,7 +4,7 @@
f << %{
<VirtualHost *:80>
ServerName #{ARGV[1]}
- DocumentRoot "#{ARGV[2]}"
+ DocumentRoot "#{File.join(ARGV[2], 'public')}"
</VirtualHost>
}.sub(/^\n/, '')
end
@@ -0,0 +1,24 @@
+require File.expand_path('../test_helper', __FILE__)
+
+describe "Config installer" do
+ before do
+ @tmp = File.expand_path('../tmp')
+ FileUtils.mkdir_p @tmp
+ @config_installer = File.expand_path('../../config_installer.rb', __FILE__)
+ end
+
+ after do
+ FileUtils.rm_rf @tmp
+ end
+
+ it "should create a config file" do
+ vhost_config = File.join(@tmp, 'test.vhost.conf')
+ host = "het-manfreds-blog.local"
+ path = "/User/het-manfred/rails code/blog"
+
+ `/usr/bin/env ruby #{@config_installer} '#{vhost_config}' '#{host}' '#{path}'`
+
+ vhost = File.read(vhost_config)
+ vhost.should == "<VirtualHost *:80>\n ServerName #{host}\n DocumentRoot \"#{path}/public\"\n</VirtualHost>\n"
+ end
+end

0 comments on commit 34bc64a

Please sign in to comment.