Sha256: 39e0848b9181ce8e5dbd136122eb11e1aa0d6eca5a937fb5c864e0930d73ab4c
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
require 'spec_helper' describe KCD::Lockfile do describe "without a lockfile in place already" do before do @old_dir = Dir.pwd Dir.chdir "spec/fixtures/lockfile_spec/without_lock" KCD.clear_shelf! end after do FileUtils.rm_r "cookbooks" Dir.chdir @old_dir end it "should be able to write a Cookbookfile.lock from a list of cookbooks" do KCD.shelf.shelve_cookbook('nginx', '= 0.101.0') KCD.shelf.resolve_dependencies KCD.shelf.populate_cookbooks_directory KCD.shelf.write_lockfile File.read('Cookbookfile.lock').split(/\r?\n/).sort.should == [ "cookbook 'bluepill', :locked_version => '1.0.4'", "cookbook 'build-essential', :locked_version => '1.0.0'", "cookbook 'nginx', :locked_version => '0.101.0'", "cookbook 'ohai', :locked_version => '1.0.2'", "cookbook 'runit', :locked_version => '0.15.0'" ] end end describe "with a lockfile in place" do before do @old_dir = Dir.pwd Dir.chdir "spec/fixtures/lockfile_spec/with_lock" KCD::Cookbookfile.process_install KCD.clear_shelf! end after do FileUtils.rm_r "cookbooks" FileUtils.rm "Cookbookfile.lock" Dir.chdir @old_dir end it "should populate the cookbooks directory from the lockfile" do lockfile = File.read('Cookbookfile.lock') lockfile.gsub!(/0.101.0/, '0.101.2') File::open('Cookbookfile.lock', 'wb') { |f| f.write lockfile } KCD::Cookbookfile.process_install File.read('cookbooks/nginx/metadata.rb').scan(/version\s*"([^"]+)"/).first.first.should == "0.101.2" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
knife_cookbook_dependencies-0.0.7 | spec/lib/kcd/lockfile_spec.rb |
knife_cookbook_dependencies-0.0.6 | spec/lib/kcd/lockfile_spec.rb |