Sha256: 458dd0d902429a9342f0a9e2478118ba91d5902ea41543e7a880c7227d9a2153

Contents?: true

Size: 627 Bytes

Versions: 3

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true

RSpec.describe SoapyBing::Helpers::ZipDownloader do
  describe '#read' do
    let(:hello_zip_file_path) { File.join('spec', 'fixtures', 'helpers', 'hello.zip') }
    let(:hello_response) do
      instance_double(HTTParty::Response, body: File.read(hello_zip_file_path))
    end
    let(:download_url) { 'https://example.com/file.zip' }

    subject(:instance) { described_class.new(download_url) }

    it 'unzips and reads file content' do
      expect(HTTParty).to receive(:get).with(download_url).and_return(hello_response)
      expect(instance.read).to eq("Hello World\n")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
soapy_bing-1.0.1 spec/soapy_bing/helpers/zip_downloader_spec.rb
soapy_bing-1.0.0 spec/soapy_bing/helpers/zip_downloader_spec.rb
soapy_bing-0.4.0 spec/soapy_bing/helpers/zip_downloader_spec.rb