spec/groupdocs/storage/file_spec.rb in groupdocs-1.2.11 vs spec/groupdocs/storage/file_spec.rb in groupdocs-1.3.0

- old
+ new

@@ -10,17 +10,17 @@ mock_api_server(load_json('file_upload')) end it 'accepts access credentials hash' do lambda do - described_class.upload!(__FILE__, {}, client_id: 'client_id', private_key: 'private_key') + described_class.upload!(__FILE__, {}, :client_id => 'client_id', :private_key => 'private_key') end.should_not raise_error(ArgumentError) end it 'accepts options hash' do lambda do - described_class.upload!(__FILE__, path: 'folder1') + described_class.upload!(__FILE__, :path => 'folder1') end.should_not raise_error(ArgumentError) end it 'uses root folder by default' do opts = {} @@ -33,11 +33,11 @@ described_class.upload!(__FILE__, opts) opts[:name].should == Object::File.basename(__FILE__) end it 'uses name if passed' do - opts = { name: 'file.pdf' } + opts = { :name => 'file.pdf' } described_class.upload!(__FILE__, opts) opts[:name].should == opts[:name] end it 'returns GroupDocs::Storage::File object' do @@ -50,11 +50,11 @@ mock_api_server(load_json('file_upload')) end it 'accepts access credentials hash' do lambda do - described_class.upload_web!('http://www.google.com', client_id: 'client_id', private_key: 'private_key') + described_class.upload_web!('http://www.google.com', :client_id => 'client_id', :private_key => 'private_key') end.should_not raise_error(ArgumentError) end it 'returns GroupDocs::Storage::File object' do described_class.upload_web!('http://www.google.com').should be_a(GroupDocs::Storage::File) @@ -88,11 +88,11 @@ subject.type = 'Words' subject.instance_variable_get(:@type).should == 'Words' end it 'raises error if type is unknown' do - -> { subject.type = :unknown }.should raise_error(ArgumentError) + lambda { subject.type = :unknown }.should raise_error(ArgumentError) end end describe '#type' do it 'returns type in human-readable format' do @@ -123,18 +123,18 @@ end describe '#download!' do before(:each) do mock_api_server(File.read('spec/support/files/resume.pdf')) - subject.stub(name: 'resume.pdf') + subject.stub(:name => 'resume.pdf') end let(:path) { Dir.tmpdir } it 'accepts access credentials hash' do lambda do - subject.download!(path, client_id: 'client_id', private_key: 'private_key') + subject.download!(path, :client_id => 'client_id', :private_key => 'private_key') end.should_not raise_error(ArgumentError) end it 'downloads file to given path' do file = stub('file') @@ -153,17 +153,17 @@ mock_api_server(load_json('file_move')) end it 'accepts access credentials hash' do lambda do - subject.move!('folder1', {}, client_id: 'client_id', private_key: 'private_key') + subject.move!('folder1', {}, :client_id => 'client_id', :private_key => 'private_key') end.should_not raise_error(ArgumentError) end it 'accepts options credentials hash' do lambda do - subject.move!('folder1', name: 'file.pdf') + subject.move!('folder1', :name => 'file.pdf') end.should_not raise_error(ArgumentError) end it 'uses current file name by default' do subject.name = 'resume.pdf' @@ -171,11 +171,11 @@ subject.move!('folder1', opts) opts[:name].should == subject.name end it 'uses name if passed' do - opts = { name: 'file.pdf' } + opts = { :name => 'file.pdf' } subject.move!('folder1', opts) opts[:name].should == opts[:name] end it 'returns moved to file' do @@ -188,16 +188,16 @@ subject.path = '/' end it 'accepts access credentials hash' do lambda do - subject.rename!('resume.pdf', client_id: 'client_id', private_key: 'private_key') + subject.rename!('resume.pdf', :client_id => 'client_id', :private_key => 'private_key') end.should_not raise_error(ArgumentError) end it 'uses #move! to rename file' do - subject.should_receive(:move!).with(subject.path, { name: 'resume2.pdf' }, {}) + subject.should_receive(:move!).with(subject.path, { :name => 'resume2.pdf' }, {}) subject.rename!('resume2.pdf') end end describe '#copy!' do @@ -205,17 +205,17 @@ mock_api_server(load_json('file_copy')) end it 'accepts access credentials hash' do lambda do - subject.copy!('resume.pdf', {}, client_id: 'client_id', private_key: 'private_key') + subject.copy!('resume.pdf', {}, :client_id => 'client_id', :private_key => 'private_key') end.should_not raise_error(ArgumentError) end it 'accepts options credentials hash' do lambda do - subject.copy!('folder1', name: 'file.pdf') + subject.copy!('folder1', :name => 'file.pdf') end.should_not raise_error(ArgumentError) end it 'uses current file name by default' do subject.name = 'resume.pdf' @@ -223,11 +223,11 @@ subject.copy!('folder1', opts) opts[:name].should == subject.name end it 'uses name if passed' do - opts = { name: 'file.pdf' } + opts = { :name => 'file.pdf' } subject.copy!('folder1', opts) opts[:name].should == opts[:name] end it 'returns copied to file' do @@ -240,29 +240,29 @@ mock_api_server(load_json('file_compress')) end it 'accepts access credentials hash' do lambda do - subject.compress!(client_id: 'client_id', private_key: 'private_key') + subject.compress!(:client_id => 'client_id', :private_key => 'private_key') end.should_not raise_error(ArgumentError) end it 'returns archived file' do - subject.stub(name: 'resume.pdf') + subject.stub(:name => 'resume.pdf') subject.compress!.should be_a(GroupDocs::Storage::File) end it 'creates archive filename as filename + archive type' do - subject.stub(name: 'resume.pdf') + subject.stub(:name => 'resume.pdf') subject.compress!.name.should == 'resume.pdf.zip' end end describe '#delete!' do it 'accepts access credentials hash' do lambda do - subject.delete!(client_id: 'client_id', private_key: 'private_key') + subject.delete!(:client_id => 'client_id', :private_key => 'private_key') end.should_not raise_error(ArgumentError) end it 'uses file guid' do mock_api_server(load_json('file_delete')) @@ -272,10 +272,10 @@ end describe '#move_to_trash!' do it 'accepts access credentials hash' do lambda do - subject.move_to_trash!(client_id: 'client_id', private_key: 'private_key') + subject.move_to_trash!(:client_id => 'client_id', :private_key => 'private_key') end.should_not raise_error(ArgumentError) end end describe '#to_document' do