require "spec_helper"

describe Dropbox::Explorer::Client, vcr: true do
  let(:path) { File.join(Bundler.root, "spec/config/dropbox.yml") }
  let(:client) { Dropbox::Explorer::Client.new(config_path: path) }
  let(:files) { client.contents_in_path('/', only_files: true) }

  describe "#list_files" do
    it "returns list of files in folder" do
      expect(files).to be_a Array
    end

    it "returns list of files and folders in folder" do
      files = client.contents_in_path('/')
      expect(files).to be_a Array
    end
  end

  describe "#get_file_url" do
    it "get url from file" do
      expect(client.get_file_url(files.first['path'])).to match(/dl.dropboxusercontent.com/)
    end
  end
end
