spec/groupdocs/job_spec.rb in groupdocs-0.2.3 vs spec/groupdocs/job_spec.rb in groupdocs-0.2.4
- old
+ new
@@ -47,11 +47,11 @@
it 'raises error if actions are passed' do
-> { described_class.create!({}) }.should raise_error(ArgumentError)
end
it 'convert actions to byte flag' do
- described_class.should_receive(:convert_actions).with(actions).and_return(5)
+ 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)
@@ -62,14 +62,24 @@
it 'returns GroupDocs::Job object' do
described_class.create!(actions: actions).should be_a(GroupDocs::Job)
end
end
- it { should respond_to(:id) }
- it { should respond_to(:id=) }
- it { should respond_to(:documents) }
- it { should respond_to(:documents=) }
+ it { should respond_to(:id) }
+ it { should respond_to(:id=) }
+ it { should respond_to(:actions) }
+ it { should respond_to(:actions=) }
+ it { should respond_to(:out_formats) }
+ it { should respond_to(:out_formats=) }
+ it { should respond_to(:email_results) }
+ it { should respond_to(:email_results=) }
+ it { should respond_to(:url_only) }
+ it { should respond_to(:url_only=) }
+ it { should respond_to(:documents) }
+ it { should respond_to(:documents=) }
+ it { should respond_to(:requested_time) }
+ it { should respond_to(:requested_time=) }
describe '#documents=' do
let(:response) do
[{ id: 1, guid: 'fhy9yh94u238dgf', status: 0, outputs: [] },
{ id: 2, guid: 'ofh9rhy9rfohf9s', status: 2, outputs: [] }]
@@ -80,9 +90,30 @@
documents = subject.documents
documents.should be_an(Array)
documents.each do |document|
document.should be_a(GroupDocs::Document)
end
+ end
+
+ it 'does nothing if nil is passed' do
+ lambda do
+ subject.documents = nil
+ end.should_not change(subject, :documents)
+ end
+ end
+
+ describe '#requested_time' do
+ it 'converts timestamp to Time object' do
+ subject.requested_time = 1330450135000
+ subject.requested_time.should == Time.at(1330450135)
+ end
+ end
+
+ describe '#actions' do
+ it 'converts actions to human-readable format' do
+ subject.actions = 129
+ described_class.should_receive(:convert_byte_to_actions).with(129)
+ subject.actions
end
end
describe '#documents!' do
before(:each) do