2012-04-18 04:03:28 +00:00
|
|
|
require "spec_helper"
|
|
|
|
require "foreman/engine"
|
|
|
|
require "foreman/export/initscript"
|
|
|
|
require "tmpdir"
|
|
|
|
|
|
|
|
describe Foreman::Export::Initscript, :fakefs do
|
|
|
|
let(:procfile) { FileUtils.mkdir_p("/tmp/app"); write_procfile("/tmp/app/Procfile") }
|
2012-09-11 15:12:40 +00:00
|
|
|
let(:formation) { nil }
|
|
|
|
let(:engine) { Foreman::Engine.new(:formation => formation).load_procfile(procfile) }
|
|
|
|
let(:options) { Hash.new }
|
2012-09-11 18:15:08 +00:00
|
|
|
let(:initscript) { FileUtils.mkdir_p("/tmp/init"); Foreman::Export::Initscript.new("/tmp/init", engine, options) }
|
2012-04-18 04:03:28 +00:00
|
|
|
|
|
|
|
before(:each) { load_export_templates_into_fakefs("initscript") }
|
|
|
|
before(:each) { stub(initscript).say }
|
|
|
|
|
|
|
|
it "exports to the filesystem" do
|
|
|
|
initscript.export
|
|
|
|
normalize_space(File.read("/tmp/init/app")).should == normalize_space(example_export_file("initscript/app"))
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with concurrency" do
|
|
|
|
let(:options) { Hash[:concurrency => "alpha=2"] }
|
|
|
|
|
|
|
|
it "exports to the filesystem with concurrency" do
|
|
|
|
initscript.export
|
|
|
|
normalize_space(File.read("/tmp/init/app")).should == normalize_space(example_export_file("initscript/app-concurrency"))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|