Sha256: a735533567fcd663402001da3d6d19d3f820f59dca4c763f67a4e37f37a90ab4

Contents?: true

Size: 856 Bytes

Versions: 2

Compression:

Stored size: 856 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/file/muAVRRbb#zp9dvPvoVck8-4IwTazqsUqol6yiUK7kwLWOwrD8Jqo' }

    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/file/3zpE1ToL#B1L4o8POE4tER4h1tyVoGNxaXFhbjwfxhe3Eyp9nrN8' }

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rmega-0.3.2 spec/integration/file_download_spec.rb
rmega-0.3.1 spec/integration/file_download_spec.rb