Sha256: d4f91778f6243b878e6b3c55c756c0fcda306e6049f8eb12ca3522c6726d1e7b

Contents?: true

Size: 847 Bytes

Versions: 6

Compression:

Stored size: 847 Bytes

Contents

require 'integration_spec_helper'

describe 'File download' do

  context 'given a public mega url (a small file)' do

    let(:url) { 'https://mega.nz/#!QQhADCbL!vUY_phwxvkC004t5NKx7vynL16SvFfHYFkiX5vUlgjQ' }

    it 'downloads the related file' do
      Rmega.download(url, temp_folder)
      related_file = File.join(temp_folder, 'testfile.txt')
      expect(File.read(related_file)).to eq "helloworld!\n"
    end
  end

  context 'given a public mega url (a big file)' do

    let(:url) { 'https://mega.nz/#!oAhCnBKR!CPeG8X92nBjvFsBF9EprZNW_TqIUwItHMkF9G2IZEIo' }

    it 'downloads the related file' do
      Rmega.download(url, temp_folder)
      related_file = File.join(temp_folder, 'testfile_big_15mb.txt')
      md5 = Digest::MD5.file(related_file).hexdigest
      expect(md5).to eq("0451dc82ac003dbef703342e40a1b8f6")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rmega-0.2.7 spec/integration/file_download_spec.rb
rmega-0.2.6 spec/integration/file_download_spec.rb
rmega-0.2.5 spec/integration/file_download_spec.rb
rmega-0.2.4 spec/integration/file_download_spec.rb
rmega-0.2.2 spec/integration/file_download_spec.rb
rmega-0.2.1 spec/integration/file_download_spec.rb