Sha256: cd993e43ba7281d84ca8b77ea24af5edfd6da2ef752c208adaeb614e06e734e1
Contents?: true
Size: 1.43 KB
Versions: 3
Compression:
Stored size: 1.43 KB
Contents
#encoding: UTF-8 require 'spec_helper' describe Egnyte::File do before(:each) do session = Egnyte::Session.new({ key: 'api_key', domain: 'test', access_token: 'access_token' }, :implicit, 0.0) @client = Egnyte::Client.new(session) end describe "File::find" do it "should return a file object if the file exists" do stub_request(:get, "https://test.egnyte.com/pubapi/v1/fs/Shared/example.txt") .with(:headers => { 'Authorization' => 'Bearer access_token' }) .to_return(:body => File.read('./spec/fixtures/list_file.json'), :status => 200) @client.file('/Shared/example.txt').name.should == 'example.txt' end it "should raise FileOrFolderNotFound error for a non-existent file" do stub_request(:get, "https://test.egnyte.com/pubapi/v1/fs/Shared/banana.txt") .with(:headers => { 'Authorization' => 'Bearer access_token' }) .to_return(:status => 404) lambda {@client.file('Shared/banana.txt')}.should raise_error( Egnyte::FileFolderNotFound ) end it "should raise FileExpected if path to folder provided" do stub_request(:get, "https://test.egnyte.com/pubapi/v1/fs/Shared") .with(:headers => { 'Authorization' => 'Bearer access_token' }) .to_return(:body => File.read('./spec/fixtures/list_folder.json'), :status => 200) lambda {@client.file('/Shared')}.should raise_error( Egnyte::FileExpected ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
egnyte-1.0.0 | spec/file_spec.rb |
egnyte-0.1.0 | spec/file_spec.rb |
egnyte-0.0.5 | spec/file_spec.rb |