spec/lib/rda/nginx_spec.rb in rda-0.0.4 vs spec/lib/rda/nginx_spec.rb in rda-0.0.6
- old
+ new
@@ -17,11 +17,11 @@
it 'prompts nginx is not found' do
capture(:stderr) do
subject.setup
end.should == <<-PROMPT
-Config directory of Nginx is not found in the following paths:
+ERROR: Config directory of Nginx is not found in the following paths:
* /etc/nginx
* /usr/local/nginx/conf
* /opt/nginx/conf
@@ -47,63 +47,9 @@
$stdin.should_receive(:gets).and_return('\n')
capture(:stdout) do
subject.setup
end.strip.should == choice.strip
- end
- end
-
- context 'when only one config directory of nginx found' do
- let(:dummy_path) { File.dirname(__FILE__) + "/../../tmp/nginx" }
-
- before do
- FileUtils.mkdir_p dummy_path unless Dir.exists?(dummy_path)
- FileUtils.copy_file(File.dirname(__FILE__) + "/../../fixtures/nginx.conf", dummy_path + '/nginx.conf')
- Rda.configure { nginx_conf_paths [File.dirname(__FILE__) + "/../../tmp/nginx"] }
- end
-
- after do
- FileUtils.rm_r dummy_path if Dir.exists?(dummy_path)
- Rda.configure { nginx_conf_paths Rda::Nginx::DEFAULT_CONF_PATHS }
- end
-
- it 'sets Nginx properly' do
- # loads RVM
- subject.should_receive(:copy_file).with("templates/setup_load_paths.rb", "#{::Rails.root}/config/setup_load_paths.rb")
-
- # creates sites-available and sites-enabled
- %W(available enabled).each do |n|
- path = "#{dummy_path}/sites-#{n}"
- subject.should_receive(:empty_directory).with(path)
- end
-
- # sets default passenger user and group
- subject.should_receive(:gsub_file).with("#{dummy_path}/nginx.conf", /http {/, <<-PASSENGER
-http {
- passenger_default_user root;
- passenger_default_group root;
- PASSENGER
- )
-
- # sets Nginx to include sites-enabled
- subject.should_receive(:gsub_file).with("#{dummy_path}/nginx.conf", /http {/, <<-INCLUSION
-http {
- include #{dummy_path}/sites-enabled/*;
- INCLUSION
- )
-
- # creates a nginx config file for the rails application under
- # sites-available
- subject.should_receive(:template).with('templates/nginx', "#{dummy_path}/sites-available/dummy.local")
-
- # creates a symbol link to the nginx config file of the rails
- # application
- subject.should_receive(:link_file).with("#{dummy_path}/sites-available/dummy.local", "#{dummy_path}/sites-enabled/dummy.local")
-
- # creates a local hostname for the rails application
- subject.should_receive(:append_file).with("/etc/hosts", "127.0.0.1 dummy.local")
-
- subject.setup
end
end
end
describe '#discard' do