Sha256: 8a9d1d72b656cd64e37b541f10a117bf0be393ec76296bc9d58e743f324f392c

Contents?: true

Size: 1.22 KB

Versions: 11

Compression:

Stored size: 1.22 KB

Contents

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

describe Foreman::Export::Bluepill, :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(:bluepill)  { Foreman::Export::Bluepill.new("/tmp/init", engine, options) }

  before(:each) { load_export_templates_into_fakefs("bluepill") }
  before(:each) { allow(bluepill).to receive(:say) }

  it "exports to the filesystem" do
    bluepill.export
    expect(normalize_space(File.read("/tmp/init/app.pill"))).to eq(normalize_space(example_export_file("bluepill/app.pill")))
  end

  it "cleans up if exporting into an existing dir" do
    expect(FileUtils).to receive(:rm).with("/tmp/init/app.pill")

    bluepill.export
    bluepill.export
  end

  context "with a process formation" do
    let(:formation) { "alpha=2" }

    it "exports to the filesystem with concurrency" do
      bluepill.export
      expect(normalize_space(File.read("/tmp/init/app.pill"))).to eq(normalize_space(example_export_file("bluepill/app-concurrency.pill")))
    end
  end

end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
overman-0.88.1 spec/foreman/export/bluepill_spec.rb
foreman-0.88.1 spec/foreman/export/bluepill_spec.rb
overman-0.87.3 spec/foreman/export/bluepill_spec.rb
foreman-0.87.2 spec/foreman/export/bluepill_spec.rb
foreman-0.87.1 spec/foreman/export/bluepill_spec.rb
ypadlyak-foreman-0.85.0 spec/foreman/export/bluepill_spec.rb
foreman-0.87.0 spec/foreman/export/bluepill_spec.rb
foreman-0.86.0 spec/foreman/export/bluepill_spec.rb
foreman-0.85.0 spec/foreman/export/bluepill_spec.rb
foreman-0.84.0 spec/foreman/export/bluepill_spec.rb
foreman-0.83.0 spec/foreman/export/bluepill_spec.rb