spec/groupdocs/job_spec.rb in groupdocs-1.2.11 vs spec/groupdocs/job_spec.rb in groupdocs-1.3.0
- old
+ new
@@ -10,17 +10,17 @@
mock_api_server(load_json('jobs_get'))
end
it 'accepts access credentials hash' do
lambda do
- described_class.all!({}, client_id: 'client_id', private_key: 'private_key')
+ described_class.all!({}, :client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'accepts options hash' do
lambda do
- described_class.all!(page: 1, count: 2)
+ described_class.all!(:page => 1, :count => 2)
end.should_not raise_error(ArgumentError)
end
it 'returns an array of GroupDocs::Job objects' do
jobs = described_class.all!
@@ -36,11 +36,11 @@
mock_api_server(load_json('job_get'))
end
it 'accepts access credentials hash' do
lambda do
- described_class.get!(1, client_id: 'client_id', private_key: 'private_key')
+ described_class.get!(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!(1).should be_a(GroupDocs::Job)
@@ -54,31 +54,31 @@
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')
+ described_class.create!({ :actions => %w(convert) }, :client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'raises error if actions are passed' do
- -> { described_class.create!({}) }.should raise_error(ArgumentError)
+ lambda { described_class.create!({}) }.should raise_error(ArgumentError)
end
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)
+ described_class.create!(:actions => actions)
end
it 'converts array of out formats to string' do
formats = %w(pdf txt)
formats.should_receive(:join).with(?;)
- described_class.create!(actions: actions, out_formats: formats)
+ 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)
+ described_class.create!(:actions => actions).should be_a(GroupDocs::Job)
end
end
it { should have_accessor(:id) }
it { should have_accessor(:guid) }
@@ -91,13 +91,13 @@
it { should have_accessor(:requested_time) }
describe '#documents=' do
let(:response) do
{
- inputs: [
- { id: 1, guid: 'fhy9yh94u238dgf', status: 0, outputs: [] },
- { id: 2, guid: 'ofh9rhy9rfohf9s', status: 2, outputs: [] }
+ :inputs => [
+ { :id => 1, :guid => 'fhy9yh94u238dgf', :status => 0, :outputs => [] },
+ { :id => 2, :guid => 'ofh9rhy9rfohf9s', :status => 2, :outputs => [] }
]
}
end
it 'saves documents as array of GroupDocs::Document objects' do
@@ -140,11 +140,11 @@
mock_api_server(load_json('job_documents'))
end
it 'accepts access credentials hash' do
lambda do
- subject.documents!(client_id: 'client_id', private_key: 'private_key')
+ subject.documents!(:client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'updates job status' do
subject.documents!
@@ -171,37 +171,37 @@
end
end
it 'returns empty arrays if there are no documents' do
mock_api_server('{ "status": "Ok", "result": {}}')
- subject.documents!.should == { inputs: [], outputs: [] }
+ subject.documents!.should == { :inputs => [], :outputs => [] }
end
end
describe '#add_document!' do
before(:each) do
mock_api_server(load_json('job_file_add'))
end
let(:document) do
- GroupDocs::Document.new(file: GroupDocs::Storage::File.new)
+ GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
end
it 'accepts access credentials hash' do
lambda do
- subject.add_document!(document, {}, client_id: 'client_id', private_key: 'private_key')
+ subject.add_document!(document, {}, :client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'accepts options hash' do
lambda do
- subject.add_document!(document, output_formats: %w(pdf txt))
+ subject.add_document!(document, :output_formats => %w(pdf txt))
end.should_not raise_error(ArgumentError)
end
it 'raises error if document is not an instance of GroupDocs::Document' do
- -> { subject.add_document!('Document') }.should raise_error(ArgumentError)
+ lambda { subject.add_document!('Document') }.should raise_error(ArgumentError)
end
it 'returns document ID' do
subject.add_document!(document).should be_an(Integer)
end
@@ -212,40 +212,40 @@
mock_api_server('{ "result": {}, "status": "Ok" }')
end
it 'accepts access credentials hash' do
lambda do
- subject.delete_document!('a9ufg8s7dfgsdf', client_id: 'client_id', private_key: 'private_key')
+ subject.delete_document!('a9ufg8s7dfgsdf', :client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'returns empty hash' do
subject.delete_document!('a9ufg8s7dfgsdf').should be_empty
end
end
describe '#add_datasource!' do
let(:document) do
- GroupDocs::Document.new(file: GroupDocs::Storage::File.new)
+ GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
end
let(:datasource) do
GroupDocs::DataSource.new
end
it 'accepts access credentials hash' do
lambda do
- subject.add_datasource!(document, datasource, client_id: 'client_id', private_key: 'private_key')
+ subject.add_datasource!(document, datasource, :client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'raises error if document is not an instance of GroupDocs::Document' do
- -> { subject.add_datasource!('Document') }.should raise_error(ArgumentError)
+ lambda { subject.add_datasource!('Document') }.should raise_error(ArgumentError)
end
it 'raises error if datasource is not an instance of GroupDocs::DataSource' do
- -> { subject.add_datasource!(document, 'DataSource') }.should raise_error(ArgumentError)
+ lambda { subject.add_datasource!(document, 'DataSource') }.should raise_error(ArgumentError)
end
end
describe '#add_url!' do
before(:each) do
@@ -254,17 +254,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')
+ subject.add_url!(url, {}, :client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'accepts options hash' do
lambda do
- subject.add_url!(url, out_formats: %W(pdf txt))
+ subject.add_url!(url, :out_formats => %W(pdf txt))
end.should_not raise_error(ArgumentError)
end
it 'returns document ID' do
subject.add_url!(url).should be_an(Integer)
@@ -276,40 +276,40 @@
mock_api_server(load_json('job_update'))
end
it 'accepts access credentials hash' do
lambda do
- subject.update!({}, client_id: 'client_id', private_key: 'private_key')
+ subject.update!({}, :client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'parses status' do
subject.should_receive(:parse_status).with(:draft).and_return(-1)
- subject.update!(status: :draft)
+ subject.update!(:status => :draft)
end
end
describe '#delete!' do
before(:each) do
mock_api_server('{ "status": "Ok", "result": {} }')
end
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
end
describe '#convert_actions_to_byte' do
let(:actions) { %w(convert compare) }
it 'raises error if actions is not an array' do
- -> { described_class.convert_actions_to_byte(:export) }.should raise_error(ArgumentError)
+ lambda { described_class.convert_actions_to_byte(:export) }.should raise_error(ArgumentError)
end
it 'raises error if action is unknown' do
- -> { described_class.convert_actions_to_byte(%w(unknown)) }.should raise_error(ArgumentError)
+ lambda { described_class.convert_actions_to_byte(%w(unknown)) }.should raise_error(ArgumentError)
end
it 'converts each action to Symbol' do
actions.each do |action|
symbol = action.to_sym