Sha256: cb3262e2081abe4de0bb4b2d6d20a7334b2984c9d2d3ff06f498981ce6cecf87

Contents?: true

Size: 903 Bytes

Versions: 6

Compression:

Stored size: 903 Bytes

Contents

require 'integration_spec_helper'

describe "rmega-dl" do

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

  def call(*args)
    `bundle exec ./bin/rmega-dl #{args.join(' ')}`
  end

  context "without args" do

    it "shows the help" do
      expect(call).to match(/usage/i)
    end
  end

  context "given a public link" do
    it "downloads a file" do
      call("'#{url}' -o #{temp_folder}")
      downloaded_file = "#{temp_folder}/testfile.txt"
      expect(File.read(downloaded_file)).to eq "helloworld!\n"
    end
  end

  if account?
    context "given an account and a path" do
      it "downloads a file" do
        call("/test_folder/a.txt -u #{account['email']} --pass #{account['password']} -o #{temp_folder}")
        downloaded_file = "#{temp_folder}/a.txt"
        expect(File.read(downloaded_file)).to eq "hello\n"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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