spec/foreman/export/supervisord_spec.rb in foreman-0.42.0 vs spec/foreman/export/supervisord_spec.rb in foreman-0.43.0

- old
+ new

@@ -13,27 +13,25 @@ before(:each) { stub(supervisord).say } it "exports to the filesystem" do supervisord.export - File.read("/tmp/init/app.conf").should == example_export_file("supervisord/app.conf") + File.read("/tmp/init/app.conf").should == example_export_file("supervisord/app.conf") end it "cleans up if exporting into an existing dir" do mock(FileUtils).rm("/tmp/init/app.conf") - supervisord.export supervisord.export end context "with concurrency" do let(:options) { Hash[:concurrency => "alpha=2"] } it "exports to the filesystem with concurrency" do supervisord.export - - File.read("/tmp/init/app.conf").should == example_export_file("supervisord/app-alpha-2.conf") + File.read("/tmp/init/app.conf").should == example_export_file("supervisord/app-alpha-2.conf") end end context "with alternate templates" do let(:template_root) { "/tmp/alternate" } @@ -44,11 +42,10 @@ File.open("#{template_root}/app.conf.erb", "w") { |f| f.puts "alternate_template" } end it "can export with alternate template files" do supervisord.export - File.read("/tmp/init/app.conf").should == "alternate_template\n" end end context "with alternate templates from home dir" do @@ -65,11 +62,24 @@ ENV['HOME'] = ENV.delete('_FOREMAN_SPEC_HOME') end it "can export with alternate template files" do supervisord.export - File.read("/tmp/init/app.conf").should == "default_alternate_template\n" + end + end + + context "environment export" do + it "correctly translates environment when exporting" do + File.open("/tmp/supervisord_env", "w") { |f| f.puts("QUEUE=fastqueue,slowqueue\nVERBOSE=1") } + + engine = Foreman::Engine.new(procfile,:env => "/tmp/supervisord_env") + supervisor = Foreman::Export::Supervisord.new("/tmp/init", engine, options) + stub(supervisor).say + + supervisor.export + + File.read("/tmp/init/app.conf").should == example_export_file("supervisord/app-env-with-comma.conf") end end end