How do I write chefspec code for seven_zip_archive resource?

177 Views Asked by At

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.
0

There are 0 best solutions below