spec/groupdocs/document/annotation_spec.rb in groupdocs-0.2.8 vs spec/groupdocs/document/annotation_spec.rb in groupdocs-0.2.9
- old
+ new
@@ -8,50 +8,58 @@
file = GroupDocs::Storage::File.new
document = GroupDocs::Document.new(file: file)
described_class.new(document: document)
end
- it { should respond_to(:document) }
- it { should respond_to(:document=) }
- it { should respond_to(:id) }
- it { should respond_to(:id=) }
- it { should respond_to(:guid) }
- it { should respond_to(:guid=) }
- it { should respond_to(:sessionGuid) }
- it { should respond_to(:sessionGuid=) }
- it { should respond_to(:documentGuid) }
- it { should respond_to(:documentGuid=) }
- it { should respond_to(:replyGuid) }
- it { should respond_to(:replyGuid=) }
- it { should respond_to(:createdOn) }
- it { should respond_to(:createdOn=) }
- it { should respond_to(:type) }
- it { should respond_to(:type=) }
- it { should respond_to(:access) }
- it { should respond_to(:access=) }
- it { should respond_to(:box) }
- it { should respond_to(:box=) }
- it { should respond_to(:replies) }
- it { should respond_to(:replies=) }
+ it { should respond_to(:document) }
+ it { should respond_to(:document=) }
+ it { should respond_to(:id) }
+ it { should respond_to(:id=) }
+ it { should respond_to(:guid) }
+ it { should respond_to(:guid=) }
+ it { should respond_to(:sessionGuid) }
+ it { should respond_to(:sessionGuid=) }
+ it { should respond_to(:documentGuid) }
+ it { should respond_to(:documentGuid=) }
+ it { should respond_to(:replyGuid) }
+ it { should respond_to(:replyGuid=) }
+ it { should respond_to(:createdOn) }
+ it { should respond_to(:createdOn=) }
+ it { should respond_to(:type) }
+ it { should respond_to(:type=) }
+ it { should respond_to(:access) }
+ it { should respond_to(:access=) }
+ it { should respond_to(:box) }
+ it { should respond_to(:box=) }
+ it { should respond_to(:replies) }
+ it { should respond_to(:replies=) }
+ it { should respond_to(:annotationPosition) }
+ it { should respond_to(:annotationPosition=) }
it 'has human-readable accessors' do
subject.should respond_to(:session_guid)
subject.should respond_to(:session_guid=)
subject.should respond_to(:document_guid)
subject.should respond_to(:document_guid=)
subject.should respond_to(:reply_guid)
subject.should respond_to(:reply_guid=)
subject.should respond_to(:created_on)
subject.should respond_to(:created_on=)
- subject.method(:session_guid).should == subject.method(:sessionGuid)
- subject.method(:session_guid=).should == subject.method(:sessionGuid=)
- subject.method(:document_guid).should == subject.method(:documentGuid)
- subject.method(:document_guid=).should == subject.method(:documentGuid=)
- subject.method(:reply_guid).should == subject.method(:replyGuid)
- subject.method(:reply_guid=).should == subject.method(:replyGuid=)
+ subject.should respond_to(:annotation_position)
+ subject.should respond_to(:annotation_position=)
+ subject.should respond_to(:position)
+ subject.method(:session_guid).should == subject.method(:sessionGuid)
+ subject.method(:session_guid=).should == subject.method(:sessionGuid=)
+ subject.method(:document_guid).should == subject.method(:documentGuid)
+ subject.method(:document_guid=).should == subject.method(:documentGuid=)
+ subject.method(:reply_guid).should == subject.method(:replyGuid)
+ subject.method(:reply_guid=).should == subject.method(:replyGuid=)
# Annotation#created_on is overwritten
- subject.method(:created_on=).should == subject.method(:createdOn=)
+ subject.method(:created_on=).should == subject.method(:createdOn=)
+ subject.method(:annotation_position).should == subject.method(:annotationPosition)
+ subject.method(:annotation_position=).should == subject.method(:annotationPosition=)
+ subject.method(:position).should == subject.method(:annotation_position)
end
it 'is compatible with response JSON' do
subject.should respond_to(:annotationGuid=)
subject.method(:annotationGuid=).should == subject.method(:guid=)
@@ -237,8 +245,26 @@
describe '#replies!' do
it 'calls GroupDocs::Document::Annotation::Reply.get!' do
GroupDocs::Document::Annotation::Reply.should_receive(:get!).with(subject, {}, {})
subject.replies!
+ end
+ end
+
+ describe '#move!' do
+ before(:each) do
+ mock_api_server(load_json('annotation_move'))
+ end
+
+ it 'accepts access credentials hash' do
+ lambda do
+ subject.move!(10, 10, client_id: 'client_id', private_key: 'private_key')
+ end.should_not raise_error(ArgumentError)
+ end
+
+ it 'updates annotation position' do
+ lambda do
+ subject.move!(10, 10)
+ end.should change(subject, :annotation_position).to(x: 10, y: 10)
end
end
end