Sha256: 86a43ebaf0fe19c522e3fb3e11b2cd0fbda1917dda49dd72559c70ee240865a9

Contents?: true

Size: 1.47 KB

Versions: 6

Compression:

Stored size: 1.47 KB

Contents

Then(/^the cache should exist$/) do
  cache_dir = File.join(@repo.root_folder,'.onceover')
  expect(File.directory?(cache_dir)).to be true
end

Then(/^the cache should contain all controlrepo files/) do
  # Get all root files
  log("Calculating MD5 hashes in repo")
  repo_digest = Cache_Helper.digest(@repo.root_folder)
  log("#{repo_digest.count} MD5 hashes calculated")
  log("Calculating MD5 hashes in cache")
  cache_digest = Cache_Helper.digest(File.join(@repo.root_folder,'.onceover/etc/puppetlabs/code/environments/production/'))
  log("#{cache_digest.count} MD5 hashes calculated")
  expect(cache_digest).to include(repo_digest)
end

When(/^I (\w+) a file "(.*)"$/) do |action,file|
  require 'securerandom'
  actual_file = Pathname.new(File.join(@repo.root_folder,file))
  case action
  when "create"
    FileUtils.mkdir_p(actual_file.dirname)
    File.write(actual_file,SecureRandom.hex)
  when "delete"
    FileUtils.rm(actual_file)
  end
end

Then(/^"(.*)" should be cached correctly$/) do |file|
  original_digest = Cache_Helper.digest(File.join(@repo.root_folder,file))
  cache_digest    = Cache_Helper.digest(File.join(@repo.root_folder,'.onceover/etc/puppetlabs/code/environments/production/',file))
  expect(original_digest).to include(cache_digest)
end

Then(/^"([^"]*)" should be deleted from the cache$/) do |file|
  deleted_file = Pathname.new(File.join(@repo.root_folder,'.onceover/etc/puppetlabs/code/environments/production/',file))
  expect(deleted_file.exist?).to be false
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
onceover-4.0.0 features/step_definitions/cache.rb
onceover-3.22.0 features/step_definitions/cache.rb
onceover-3.21.0 features/step_definitions/cache.rb
onceover-3.20.0 features/step_definitions/cache.rb
onceover-3.19.2 features/step_definitions/cache.rb
onceover-3.19.1 features/step_definitions/cache.rb