Sha256: dd29b7f3fbda0029a1ad41782d565a02794e7ce71ae2896edfebcc269dd75177

Contents?: true

Size: 1.58 KB

Versions: 10

Compression:

Stored size: 1.58 KB

Contents

require "spec_helper"
require "foreman/engine"
require "foreman/export/runit"
require "tmpdir"

describe Foreman::Export::Runit do
  let(:procfile) { FileUtils.mkdir_p("/tmp/app"); write_procfile("/tmp/app/Procfile", 'bar=baz') }
  let(:engine) { Foreman::Engine.new(procfile) }
  let(:runit) { Foreman::Export::Runit.new(engine) }
  
  before(:each) { load_export_templates_into_fakefs("runit") }
  before(:each) { stub(runit).say }
  before(:each) { stub(FakeFS::FileUtils).chmod }
  
  it "exports to the filesystem" do
    FileUtils.mkdir_p('/tmp/init')
    runit.export('/tmp/init', :concurrency => "alpha=2,bravo=1")
    
    File.read("/tmp/init/app-alpha-1/run").should == example_export_file('runit/app-alpha-1-run')
    File.read("/tmp/init/app-alpha-1/log/run").should == 
        example_export_file('runit/app-alpha-1-log-run')
    File.read("/tmp/init/app-alpha-1/env/PORT").should == "5000\n"
    File.read("/tmp/init/app-alpha-1/env/BAR").should == "baz\n"
    
    File.read("/tmp/init/app-alpha-2/run").should == example_export_file('runit/app-alpha-2-run')
    File.read("/tmp/init/app-alpha-2/log/run").should == 
        example_export_file('runit/app-alpha-2-log-run')
    File.read("/tmp/init/app-alpha-2/env/PORT").should == "5001\n"
    File.read("/tmp/init/app-alpha-2/env/BAR").should == "baz\n"
    
    File.read("/tmp/init/app-bravo-1/run").should == example_export_file('runit/app-bravo-1-run')
    File.read("/tmp/init/app-bravo-1/log/run").should == 
        example_export_file('runit/app-bravo-1-log-run')
    File.read("/tmp/init/app-bravo-1/env/PORT").should == "5100\n"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman-0.37.0.pre3-mingw32 spec/foreman/export/runit_spec.rb
foreman-0.37.0.pre3-java spec/foreman/export/runit_spec.rb
foreman-0.37.0.pre3 spec/foreman/export/runit_spec.rb
foreman-0.37.0.pre2-java spec/foreman/export/runit_spec.rb
foreman-0.37.0.pre2 spec/foreman/export/runit_spec.rb
foreman-0.37.0.pre1-java spec/foreman/export/runit_spec.rb
foreman-0.37.0.pre1 spec/foreman/export/runit_spec.rb
foreman-0.36.1 spec/foreman/export/runit_spec.rb
foreman-0.36.0 spec/foreman/export/runit_spec.rb
foreman-0.35.0 spec/foreman/export/runit_spec.rb