0

I have used a resource seven_zip_archive to unzip files. I need to write chefspec code for this resource. I have not found any solution yet.

I tried something like:-

it ('updates 7zip') do
            expect(chef_run).to add_windows_path("xyz_driver_install_unpack").with(path:"C:\\Program Files\\XYZ Driver")
      end

Recipe:-

seven_zip_archive "#{cookbook_name}_#{recipe_name}_unpack" do
  not_if { ::Dir.exist?(install_directory) }
  path install_directory
  source media_file
end

I get error like:-

Failure/Error: expect(chef_run).to add_windows_path("xyz_driver_install_unpack").with(path:"C:\Program Files\XYZ Driver")

   expected `"windows_path[xyz_driver_install_unpack]"` with action :add to be in Chef run.
Nipun Tharuksha
  • 2,496
  • 4
  • 17
  • 40
  • Do you intend to install the 7zip program or extract a 7zip archive? (ex a file ending in .7z or .zip) - perhaps the docs can help? https://supermarket.chef.io/cookbooks/seven_zip#readme Note that the `seven_zip` cookbook is used to install the 7zip program and the `seven_zip_archive` resource can extract a 7zip compatible file. `seven_zip_archive` shouldn't modify the windows path. – Stan Kurdziel Jul 25 '19 at 22:44
  • I wanted to use the seven_zip_archive resource to unpack/unzip the installed files in a directory. With regard to that I wanted to test this resource seven_zip_archive through chef spec. – Ikshaku Goswami Jul 26 '19 at 10:08

0 Answers0