Sha256: 91c83b68e6e63a91ed43958e149867682d9cacf20baaf760882afc915e4cd8d2

Contents?: true

Size: 1.46 KB

Versions: 105

Compression:

Stored size: 1.46 KB

Contents

require "spec_helper"

describe CFManifests::Builder do
  subject { CFManifests::Loader.new(nil, nil) }

  describe "#build" do
    let(:file) { "manifest.yml" }

    before do
      FakeFS.activate!

      File.open(file, "w") do |io|
        io.write manifest
      end
    end

    after do
      FakeFS.deactivate!
      FakeFS::FileSystem.clear
    end

    context "with a simple manifest" do
      let(:manifest) do
        <<EOF
---
foo: bar
EOF
      end

      it "loads the manifest YAML" do
        expect(subject.build(file)).to eq("foo" => "bar")
      end
    end

    context "with a manifest that inherits another" do
      let(:manifest) do
        <<EOF
---
inherit: other-manifest.yml
foo:
  baz: c
EOF
      end

      before do
        FakeFS.activate!

        File.open("other-manifest.yml", "w") do |io|
          io.write <<OTHER
---
foo:
  bar: a
  baz: b
OTHER
        end
      end

      it "merges itself into the parent, by depth" do
        manifest = subject.build(file)
        expect(manifest).to include(
          "foo" => { "bar" => "a", "baz" => "c" })
      end

      it "does not include the 'inherit' attribute" do
        manifest = subject.build(file)
        expect(manifest).to_not include("inherit")
      end
    end

    context "with an invalid manifest" do
      let(:manifest) { "" }

      it "raises an error" do
        expect {
          subject.build(file)
        }.to raise_error(CFManifests::InvalidManifest)
      end
    end
  end
end

Version data entries

105 entries across 105 versions & 2 rubygems

Version Path
cf-3.0.0rc2 spec/manifests/loader/builder_spec.rb
cf-3.0.0rc1 spec/manifests/loader/builder_spec.rb
cf-2.1.0 spec/manifests/loader/builder_spec.rb
cf-2.0.1 spec/manifests/loader/builder_spec.rb
cf-2.0.0 spec/manifests/loader/builder_spec.rb
cf-1.1.4 spec/manifests/loader/builder_spec.rb
cf-1.1.3.rc1 spec/manifests/loader/builder_spec.rb
cf-1.1.2 spec/manifests/loader/builder_spec.rb
cf-1.1.2.rc2 spec/manifests/loader/builder_spec.rb
cf-1.1.2.rc1 spec/manifests/loader/builder_spec.rb
cf-1.1.1 spec/manifests/loader/builder_spec.rb
cf-1.1.0 spec/manifests/loader/builder_spec.rb
cf-1.0.1.rc1 spec/manifests/loader/builder_spec.rb
cf-1.0.0 spec/manifests/loader/builder_spec.rb
cf-0.6.1.rc110 spec/manifests/loader/builder_spec.rb
cf-0.6.1.rc19 spec/manifests/loader/builder_spec.rb
cf-0.6.1.rc18 spec/manifests/loader/builder_spec.rb
cf-0.6.1.rc17 spec/manifests/loader/builder_spec.rb
cf-0.6.1.rc16 spec/manifests/loader/builder_spec.rb
cf-0.6.1.rc15 spec/manifests/loader/builder_spec.rb