Sha256: bc79bb801a6cba496fbaed557558cc5ffb81b90a3deee727d1cee29b962f7c87

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'
require 'foreman/procfile'
require 'pathname'
require 'tmpdir'

describe Foreman::Procfile, :fakefs do
  subject { Foreman::Procfile.new }

  it "can load from a file" do
    write_procfile
    subject.load "Procfile"
    expect(subject["alpha"]).to eq("./alpha")
    expect(subject["bravo"]).to eq("./bravo")
  end

  it "loads a passed-in Procfile" do
    write_procfile
    procfile = Foreman::Procfile.new("Procfile")
    expect(procfile["alpha"]).to   eq("./alpha")
    expect(procfile["bravo"]).to   eq("./bravo")
    expect(procfile["foo-bar"]).to eq("./foo-bar")
    expect(procfile["foo_bar"]).to eq("./foo_bar")
  end

  it "can have a process appended to it" do
    subject["charlie"] = "./charlie"
    expect(subject["charlie"]).to eq("./charlie")
  end

  it "can write to a string" do
    subject["foo"] = "./foo"
    subject["bar"] = "./bar"
    expect(subject.to_s).to eq("foo: ./foo\nbar: ./bar")
  end

  it "can write to a file" do
    subject["foo"] = "./foo"
    subject["bar"] = "./bar"
    subject.save "/tmp/proc"
    expect(File.read("/tmp/proc")).to eq("foo: ./foo\nbar: ./bar\n")
  end

end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
foreman-systemd-0.78.0 spec/foreman/procfile_spec.rb
foreman-0.78.0 spec/foreman/procfile_spec.rb
foreman-0.77.0 spec/foreman/procfile_spec.rb
foreman-0.76.0 spec/foreman/procfile_spec.rb
foreman-0.75.0 spec/foreman/procfile_spec.rb
foreman-0.74.0 spec/foreman/procfile_spec.rb
foreman-0.73.0 spec/foreman/procfile_spec.rb
foreman-0.71.0 spec/foreman/procfile_spec.rb
foreman-0.70.0 spec/foreman/procfile_spec.rb
foreman-0.69.0-mingw32 spec/foreman/procfile_spec.rb
foreman-0.69.0 spec/foreman/procfile_spec.rb