Sha256: dad6714f7f0805ca88c7def5ff15be79196c945c9fe1a3bdd16b45cc95b93adf

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

module Berkshelf
  describe Lockfile do
    let(:downloader) { Downloader.new(Berkshelf.cookbook_store) }
    
    describe "without a lockfile in place already" do
      before(:all) do
        @old_dir = Dir.pwd
        Dir.chdir fixtures_path.join("lockfile_spec", "without_lock")
      end

      after(:all) do
        FileUtils.rm(fixtures_path.join("lockfile_spec", "without_lock", "Berksfile.lock"))
        Dir.chdir(@old_dir)
      end

      it "should be able to write a Berksfile.lock from a list of cookbooks" do
        resolver = Resolver.new(downloader, sources: CookbookSource.new('nginx', constraint: '= 0.101.0'))
        resolver.resolve

        Lockfile.new(resolver.sources).write

        File.read('Berksfile.lock').split(/\r?\n/).should =~ [
          "cookbook 'bluepill', :locked_version => '1.1.0'",
          "cookbook 'build-essential', :locked_version => '1.1.2'",
          "cookbook 'nginx', :locked_version => '0.101.0'",
          "cookbook 'ohai', :locked_version => '1.0.2'",
          "cookbook 'runit', :locked_version => '0.15.0'"
        ]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
berkshelf-1.0.0.rc1 spec/unit/berkshelf/lockfile_spec.rb
berkshelf-0.6.0.beta4 spec/unit/berkshelf/lockfile_spec.rb
berkshelf-0.6.0.beta3 spec/unit/berkshelf/lockfile_spec.rb