spec/lib/rda/nginx_spec.rb in rda-0.0.1 vs spec/lib/rda/nginx_spec.rb in rda-0.0.2

- old
+ new

@@ -65,20 +65,31 @@ 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/*; + include #{dummy_path}/sites-enabled/*; INCLUSION ) # creates a nginx config file for the rails application under # sites-available @@ -115,9 +126,10 @@ it 'discards the settings' do subject.should_receive(:gsub_file).with("/etc/hosts", "dummy.local 127.0.0.1", '') %W(enabled available).each do |n| subject.should_receive(:remove_file).with("#{dummy_path}/sites-#{n}/dummy.local") end + subject.should_receive(:remove_file).with("#{::Rails.root}/config/setup_load_paths.rb") subject.discard end end end