spec/groupdocs/document/annotation_spec.rb in groupdocs-1.2.11 vs spec/groupdocs/document/annotation_spec.rb in groupdocs-1.3.0
- old
+ new
@@ -5,12 +5,12 @@
it_behaves_like GroupDocs::Api::Entity
include_examples GroupDocs::Api::Helpers::AccessMode
subject do
file = GroupDocs::Storage::File.new
- document = GroupDocs::Document.new(file: file)
- described_class.new(document: document)
+ document = GroupDocs::Document.new(:file => file)
+ described_class.new(:document => document)
end
it { should have_accessor(:document) }
it { should have_accessor(:id) }
it { should have_accessor(:guid) }
@@ -36,15 +36,15 @@
it { should have_alias(:annotationGuid=, :guid=) }
describe '#initialize' do
it 'raises error if document is not specified' do
- -> { described_class.new }.should raise_error(ArgumentError)
+ lambda { described_class.new }.should raise_error(ArgumentError)
end
it 'raises error if document is not an instance of GroupDocs::Document' do
- -> { described_class.new(document: '') }.should raise_error(ArgumentError)
+ lambda { described_class.new(:document => '') }.should raise_error(ArgumentError)
end
end
describe '#type=' do
it 'saves type in machine readable format if symbol is passed' do
@@ -56,11 +56,11 @@
subject.type = 'Area'
subject.instance_variable_get(:@type).should == 'Area'
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
@@ -88,11 +88,11 @@
end
end
describe '#box=' do
it 'converts passed hash to GroupDocs::Document::Rectangle object' do
- subject.box = { x: 0.90, y: 0.05, width: 0.06745, height: 0.005967 }
+ subject.box = { :x => 0.90, :y => 0.05, :width => 0.06745, :height => 0.005967 }
subject.box.should be_a(GroupDocs::Document::Rectangle)
subject.box.x.should == 0.90
subject.box.y.should == 0.05
subject.box.w.should == 0.06745
subject.box.h.should == 0.005967
@@ -109,12 +109,12 @@
reply.annotation.should == subject
end
end
it 'saves each reply if it is GroupDocs::Document::Annotation::Reply object' do
- reply1 = GroupDocs::Document::Annotation::Reply.new(annotation: subject)
- reply2 = GroupDocs::Document::Annotation::Reply.new(annotation: subject)
+ reply1 = GroupDocs::Document::Annotation::Reply.new(:annotation => subject)
+ reply2 = GroupDocs::Document::Annotation::Reply.new(:annotation => subject)
subject.replies = [reply1, reply2]
subject.replies.should include(reply1)
subject.replies.should include(reply2)
end
@@ -125,15 +125,15 @@
end
end
describe '#add_reply' do
it 'raises error if reply is not GroupDocs::Document::Annotation::Reply object' do
- -> { subject.add_reply('Reply') }.should raise_error(ArgumentError)
+ lambda { subject.add_reply('Reply') }.should raise_error(ArgumentError)
end
it 'saves reply' do
- reply = GroupDocs::Document::Annotation::Reply.new(annotation: subject)
+ reply = GroupDocs::Document::Annotation::Reply.new(:annotation => subject)
subject.add_reply(reply)
subject.replies.should == [reply]
end
end
@@ -142,11 +142,11 @@
mock_api_server(load_json('annotation_create'))
end
it 'accepts access credentials hash' do
lambda do
- subject.create!(client_id: 'client_id', private_key: 'private_key')
+ subject.create!(:client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'uses hashed version of self as request body' do
subject.should_receive(:to_hash).and_return({})
@@ -171,11 +171,11 @@
mock_api_server(load_json('annotation_remove'))
end
it 'accepts access credentials hash' do
lambda do
- subject.remove!(client_id: 'client_id', private_key: 'private_key')
+ subject.remove!(:client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
end
describe '#replies!' do
@@ -190,34 +190,34 @@
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')
+ 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.should change(subject, :annotation_position).to(:x => 10, :y => 10)
end
end
describe '#move_marker!' do
before(:each) do
mock_api_server('{ "status": "Ok", "result": {}}')
end
it 'accepts access credentials hash' do
lambda do
- subject.move_marker!(10, 10, client_id: 'client_id', private_key: 'private_key')
+ subject.move_marker!(10, 10, :client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'updates box coordinates if it is set' do
- subject.box = { x: 1, y: 2 }
+ subject.box = { :x => 1, :y => 2 }
subject.move_marker! 10, 10
subject.box.x.should == 10
subject.box.y.should == 10
end
@@ -233,10 +233,10 @@
mock_api_server(load_json('annotation_access_set'))
end
it 'accepts access credentials hash' do
lambda do
- subject.set_access!(:private, client_id: 'client_id', private_key: 'private_key')
+ subject.set_access!(:private, :client_id => 'client_id', :private_key => 'private_key')
end.should_not raise_error(ArgumentError)
end
it 'updates annotation access mode' do
subject.set_access!(:private)