Sha256: 9fe0f8efde9fa312acf1542046398d6f9525fda035edce7de478b2a8af629188

Contents?: true

Size: 853 Bytes

Versions: 1

Compression:

Stored size: 853 Bytes

Contents

require 'integration_spec_helper'

describe 'File download' do

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

    let(:url) { 'https://mega.co.nz/#!MAkg2Iab!bc9Y2U6d93IlRRKVYpcC9hLZjS4G278OPdH6nTFPDNQ' }

    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.co.nz/#!NYVkDaLD!BKyN5SRpOaEtGnTcwiAqcxmJc7p-k0IPWKAW-471KRE' }

    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

1 entries across 1 versions & 1 rubygems

Version Path
rmega-0.2.0 spec/integration/file_download_spec.rb