title: How would you write a test for zip file generation?
body: <p>I'm working on a service/workflow that takes a number of data files  associated with a <code>Project</code> and creates a zip of them. These files are managed by Carrierwave. I am using the native Rails TestCase/Minitest and was wondering what is the best way to test the generation of the zip file?</p>
  
  <p>At the moment, the code that would grab the files and write them to a zip looks something like:</p>
  
  <pre><code>def generate_zip(project)
    project_tracks = project.project_tracks
  
    # base temp dir
    temp_dir = Dir.mktmpdir
  
    # path for zip we are about to create
    zip_path = File.join(temp_dir, "#{project.name}.zip")
  
    Zip::ZipOutputStream.open(zip_path) do |zos|
      project_tracks.each do |project_track|
        path = project_track.track.path
        zos.put_next_entry(path)
        zos.write project_track.track.file.read
      end
    end
  end
  </code></pre>
  
  <p>Initially my thought was to create the zip files and compare the bytes? Was wondering if this was a good idea or if there is a better/faster way to test this logic.</p>