Sha256: 361d578d0965e83971fac748fc98a806651e38ad66e36ca51e7caf7b65b6def8

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

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

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

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

  it "exports to the filesystem" do
    inittab.export
    expect(File.read("/tmp/inittab")).to eq(example_export_file("inittab/inittab.default"))
  end

  context "to stdout" do
    let(:location) { "-" }

    it "exports to stdout" do
      expect(inittab).to receive(:puts).with(example_export_file("inittab/inittab.default"))
      inittab.export
    end
  end

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

    it "exports to the filesystem with concurrency" do
      inittab.export
      expect(File.read("/tmp/inittab")).to eq(example_export_file("inittab/inittab.concurrency"))
    end
  end

end

Version data entries

11 entries across 11 versions & 3 rubygems

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