Sha256: ac14df2ca0177d2380cc1649977e5c852d568b91e5e3b428eac2672d45c57ebd

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

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

describe Foreman::Export::Supervisord, :fakefs do
  let(:procfile)    { FileUtils.mkdir_p("/tmp/app"); write_procfile("/tmp/app/Procfile") }
  let(:formation)   { nil }
  let(:engine)      { Foreman::Engine.new(:formation => formation).load_procfile(procfile) }
  let(:options)     { Hash.new }
  let(:supervisord) { Foreman::Export::Supervisord.new("/tmp/init", engine, options) }

  before(:each) { load_export_templates_into_fakefs("supervisord") }
  before(:each) { stub(supervisord).say }

  it "exports to the filesystem" do
    write_env(".env", "FOO"=>"bar", "URL"=>"http://example.com/api?foo=bar&baz=1")
    supervisord.engine.load_env('.env')
    supervisord.export
    expect(File.read("/tmp/init/app.conf")).to eq(example_export_file("supervisord/app-alpha-1.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(:formation) { "alpha=2" }

    it "exports to the filesystem with concurrency" do
      supervisord.export
      expect(File.read("/tmp/init/app.conf")).to eq(example_export_file("supervisord/app-alpha-2.conf"))
    end
  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ypadlyak-foreman-0.81.0 spec/foreman/export/supervisord_spec.rb
foreman-0.82.0 spec/foreman/export/supervisord_spec.rb
foreman-0.81.0 spec/foreman/export/supervisord_spec.rb
foreman-0.80.2 spec/foreman/export/supervisord_spec.rb
foreman-0.80.1 spec/foreman/export/supervisord_spec.rb
foreman-0.80.0 spec/foreman/export/supervisord_spec.rb