spec/groupdocs/job_spec.rb in groupdocs-1.9.0 vs spec/groupdocs/job_spec.rb in groupdocs-2.0.0
- old
+ new
@@ -11,17 +11,17 @@
end
it 'accepts access credentials hash' do
lambda do
described_class.all!({}, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'accepts options hash' do
lambda do
described_class.all!(:page => 1, :count => 2)
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'returns an array of GroupDocs::Job objects' do
jobs = described_class.all!
jobs.should be_an(Array)
@@ -37,63 +37,29 @@
end
it 'accepts access credentials hash' do
lambda do
described_class.get!(1, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'returns GroupDocs::Job object' do
described_class.get!(1).should be_a(GroupDocs::Job)
end
end
- describe '.get_xml!' do
- before(:each) do
- mock_api_server(load_json('job_get'))
- end
-
- it 'accepts access credentials hash' do
- lambda do
- described_class.get_xml!(1, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
- end
-
- it 'returns GroupDocs::Job object' do
- described_class.get_xml!(1).should be_a(GroupDocs::Job)
- end
- end
-
- describe '.get_resources!' do
- before(:each) do
- mock_api_server(load_json('job_resources_get'))
- end
-
- it 'accepts access credentials hash' do
- lambda do
- described_class.get_resources!(options, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
- end
-
- it 'accepts options credentials hash' do
- lambda do
- described_class.get_resources!(:statusIds => 'Draft', :actions => [:convert, :combine], :excluded_actions => 1)
- end.should_not raise_error(ArgumentError)
- end
- end
-
describe '.create!' do
before(:each) do
mock_api_server(load_json('job_create'))
end
let(:actions) { %w(convert compress_zip) }
it 'accepts access credentials hash' do
lambda do
described_class.create!({ :actions => %w(convert) }, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'raises error if actions are passed' do
lambda { described_class.create!({}) }.should raise_error(ArgumentError)
end
@@ -101,15 +67,10 @@
it 'convert actions to byte flag' do
described_class.should_receive(:convert_actions_to_byte).with(actions).and_return(5)
described_class.create!(:actions => actions)
end
- it 'converts array of out formats to string' do
- formats = %w(pdf txt)
- described_class.create!(:actions => actions, :out_formats => formats)
- end
-
it 'returns GroupDocs::Job object' do
described_class.create!(:actions => actions).should be_a(GroupDocs::Job)
end
end
@@ -174,17 +135,17 @@
end
it 'accepts access credentials hash' do
lambda do
subject.documents!(:client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
- #it 'updates job status' do
- # subject.documents!
- # subject.status.should == :archived
- #end
+ it 'updates job status' do
+ subject.documents!
+ subject.status.should == :archived
+ end
it 'returns hash' do
subject.documents!.should be_a(Hash)
end
@@ -208,28 +169,10 @@
mock_api_server('{ "status": "Ok", "result": {}}')
subject.documents!.should == { :inputs => [], :outputs => [] }
end
end
- describe '#jobs_documents!' do
- before(:each) do
- mock_api_server(load_json('jobs_documents'))
- end
-
- it 'accepts access credentials hash' do
- lambda do
- subject.jobs_documents!({}, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
- end
-
- it 'accepts access credentials hash' do
- lambda do
- subject.jobs_documents!(:page => 1, :count => 1, :actions => 1, :excluded_actions => 1, :order_by => 'Date', :order_asc => true )
- end.should_not raise_error(ArgumentError)
- end
- end
-
describe '#add_document!' do
before(:each) do
mock_api_server(load_json('job_file_add'))
end
@@ -238,17 +181,17 @@
end
it 'accepts access credentials hash' do
lambda do
subject.add_document!(document, {}, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'accepts options hash' do
lambda do
subject.add_document!(document, :output_formats => %w(pdf txt))
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'raises error if document is not an instance of GroupDocs::Document' do
lambda { subject.add_document!('Document') }.should raise_error(ArgumentError)
end
@@ -264,19 +207,22 @@
end
it 'accepts access credentials hash' do
lambda do
subject.delete_document!('a9ufg8s7dfgsdf', :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'returns empty hash' do
subject.delete_document!('a9ufg8s7dfgsdf').should be_empty
end
end
describe '#add_datasource!' do
+ before(:each) do
+ mock_api_server('{ "status": "Ok", "result": {}}')
+ end
let(:document) do
GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
end
let(:datasource) do
@@ -284,11 +230,11 @@
end
it 'accepts access credentials hash' do
lambda do
subject.add_datasource!(document, datasource, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'raises error if document is not an instance of GroupDocs::Document' do
lambda { subject.add_datasource!('Document') }.should raise_error(ArgumentError)
end
@@ -306,17 +252,17 @@
let(:url) { 'http://www.google.com' }
it 'accepts access credentials hash' do
lambda do
subject.add_url!(url, {}, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'accepts options hash' do
lambda do
subject.add_url!(url, :out_formats => %W(pdf txt))
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'returns document ID' do
subject.add_url!(url).should be_an(Integer)
end
@@ -328,11 +274,11 @@
end
it 'accepts access credentials hash' do
lambda do
subject.update!({}, :client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
it 'parses status' do
subject.should_receive(:parse_status).with(:draft).and_return(-1)
subject.update!(:status => :draft)
@@ -345,10 +291,10 @@
end
it 'accepts access credentials hash' do
lambda do
subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
- end.should_not raise_error(ArgumentError)
+ end.should_not raise_error()
end
end
describe '#convert_actions_to_byte' do
let(:actions) { %w(convert compare) }