Sha256: 2829d375b098bfc1a43faed298422dd9d61f3c38f9070f9024128d4e5aa7da75

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

module Berkshelf
  describe InitGenerator do
    subject { InitGenerator }

    let(:target_root) { tmp_path.join("some_cookbook") }

    context "with default options" do
      before do
        generator = subject.new([target_root])
        capture(:stdout) { generator.invoke_all }
      end

      specify do
        target_root.should have_structure {
          file "Berksfile"
          no_file "chefignore"
        }
      end
    end

    context "with a chefignore" do
      before do
        generator = subject.new([target_root], chefignore: true)
        capture(:stdout) { generator.invoke_all }
      end

      specify do
        target_root.should have_structure {
          file "Berksfile"
          file "chefignore"
        }
      end
    end

    context "with a metadata entry in the Berksfile" do
      before do
        generator = subject.new([target_root], metadata_entry: true)
        capture(:stdout) { generator.invoke_all }
      end

      specify do
        target_root.should have_structure {
          file "Berksfile" do
            contains "metadata"
          end
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
berkshelf-0.4.0.rc1 spec/unit/berkshelf/init_generator_spec.rb
berkshelf-0.3.7 spec/unit/berkshelf/init_generator_spec.rb
berkshelf-0.3.3 spec/unit/berkshelf/init_generator_spec.rb