Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
Added test for config installer.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Jun 9, 2008
1 parent 2e075ef commit 34bc64a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,2 +1,4 @@
build
.DS_Store
Passenger.xcodeproj/*.mode1v3
Passenger.xcodeproj/*.pbxuser
2 changes: 1 addition & 1 deletion config_installer.rb
Expand Up @@ -4,7 +4,7 @@
f << %{
<VirtualHost *:80>
ServerName #{ARGV[1]}
DocumentRoot "#{ARGV[2]}"
DocumentRoot "#{File.join(ARGV[2], 'public')}"
</VirtualHost>
}.sub(/^\n/, '')
end
24 changes: 24 additions & 0 deletions test/config_installer_test.rb
@@ -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.