rubydora 1.6.3 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.mailmap +8 -0
- data/.travis.yml +6 -2
- data/CONTRIBUTING.md +113 -0
- data/Gemfile +0 -4
- data/LICENSE.txt +19 -20
- data/Notices.txt +20 -0
- data/README.rdoc +1 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/gemfiles/gemfile.rails3 +11 -0
- data/gemfiles/gemfile.rails4 +10 -0
- data/lib/rubydora/audit_trail.rb +5 -5
- data/lib/rubydora/datastream.rb +15 -53
- data/lib/rubydora/digital_object.rb +19 -44
- data/lib/rubydora/fc3_service.rb +89 -0
- data/lib/rubydora/fedora_url_helpers.rb +23 -4
- data/lib/rubydora/profile_parser.rb +59 -0
- data/lib/rubydora/repository.rb +24 -26
- data/lib/rubydora/rest_api_client.rb +61 -7
- data/lib/rubydora/transactions.rb +8 -7
- data/lib/rubydora.rb +2 -0
- data/rubydora.gemspec +1 -2
- data/spec/audit_trail_spec.rb +1 -1
- data/spec/lib/datastream_spec.rb +54 -15
- data/spec/lib/digital_object_spec.rb +86 -32
- data/spec/lib/integration_test_spec.rb +31 -31
- data/spec/lib/repository_spec.rb +19 -6
- data/spec/lib/resource_index_spec.rb +2 -2
- data/spec/lib/rest_api_client_spec.rb +62 -37
- data/spec/lib/transactions_spec.rb +7 -8
- metadata +14 -21
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Rubydora::RestApiClient do
|
|
4
|
+
|
|
5
|
+
include Rubydora::FedoraUrlHelpers
|
|
6
|
+
|
|
4
7
|
class FakeException < Exception
|
|
5
8
|
|
|
6
9
|
end
|
|
@@ -24,6 +27,7 @@ describe Rubydora::RestApiClient do
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
it "should replace a RestClient exception with a Rubydora one" do
|
|
30
|
+
Deprecation.stub(:warn)
|
|
27
31
|
subject.stub_chain(:client, :[], :get).and_raise RestClient::InternalServerError.new
|
|
28
32
|
subject.stub_chain(:client, :[], :put).and_raise RestClient::InternalServerError.new
|
|
29
33
|
subject.stub_chain(:client, :[], :delete).and_raise RestClient::InternalServerError.new
|
|
@@ -32,7 +36,7 @@ describe Rubydora::RestApiClient do
|
|
|
32
36
|
end
|
|
33
37
|
end
|
|
34
38
|
|
|
35
|
-
[:next_pid, :find_objects, :object, :ingest, :export, :modify_object, :purge_object, :object_versions, :object_xml, :datastream, :datastreams, :set_datastream_options, :datastream_versions, :datastream_history, :datastream_dissemination, :add_datastream, :modify_datastream, :purge_datastream, :relationships, :add_relationship, :purge_relationship, :dissemination].each do |method|
|
|
39
|
+
[:next_pid, :find_objects, :object, :ingest, :mint_pid_and_ingest, :export, :modify_object, :purge_object, :object_versions, :object_xml, :datastream, :datastreams, :set_datastream_options, :datastream_versions, :datastream_history, :datastream_dissemination, :add_datastream, :modify_datastream, :purge_datastream, :relationships, :add_relationship, :purge_relationship, :dissemination].each do |method|
|
|
36
40
|
|
|
37
41
|
class_eval %Q{
|
|
38
42
|
describe "##{method}" do
|
|
@@ -45,13 +49,16 @@ describe Rubydora::RestApiClient do
|
|
|
45
49
|
end
|
|
46
50
|
|
|
47
51
|
|
|
52
|
+
let :base_url do
|
|
53
|
+
"http://example.org"
|
|
54
|
+
end
|
|
48
55
|
|
|
49
56
|
|
|
50
57
|
before(:each) do
|
|
51
58
|
@fedora_user = 'fedoraAdmin'
|
|
52
59
|
@fedora_password = 'fedoraAdmin'
|
|
53
60
|
@mock_repository = MockRepository.new
|
|
54
|
-
@mock_repository.config = { :url =>
|
|
61
|
+
@mock_repository.config = { :url => base_url,:user => @fedora_user, :password => @fedora_password}
|
|
55
62
|
end
|
|
56
63
|
|
|
57
64
|
it "should create a REST client" do
|
|
@@ -76,42 +83,48 @@ describe Rubydora::RestApiClient do
|
|
|
76
83
|
end
|
|
77
84
|
|
|
78
85
|
it "should call nextPID" do
|
|
79
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
86
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + next_pid_url(:format => 'xml')))
|
|
80
87
|
@mock_repository.next_pid
|
|
81
88
|
end
|
|
82
89
|
|
|
83
90
|
it "should find objects" do
|
|
84
91
|
RestClient::Request.should_receive(:execute) do |params|
|
|
85
92
|
params.should have_key(:url)
|
|
86
|
-
params[:url].should =~ /^#{Regexp.escape("
|
|
93
|
+
params[:url].should =~ /^#{Regexp.escape(base_url + "/" + find_objects_url + "?")}.*query=a/
|
|
87
94
|
end
|
|
88
95
|
@mock_repository.find_objects :query => 'a'
|
|
89
96
|
end
|
|
90
97
|
|
|
91
98
|
|
|
92
99
|
it "should show object properties" do
|
|
93
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
100
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + object_url('z', :format => 'xml')))
|
|
94
101
|
@mock_repository.object :pid => 'z'
|
|
95
102
|
end
|
|
96
103
|
|
|
97
104
|
it "should raise not found exception when retrieving object" do
|
|
98
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
105
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + object_url('z', :format => 'xml'))).and_raise( RestClient::ResourceNotFound)
|
|
99
106
|
lambda {@mock_repository.object(:pid => 'z')}.should raise_error RestClient::ResourceNotFound
|
|
100
107
|
end
|
|
101
108
|
|
|
102
109
|
it "ingest" do
|
|
103
|
-
|
|
110
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + new_object_url))
|
|
111
|
+
@mock_repository.ingest
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
it "mint_pid_and_ingest" do
|
|
116
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + new_object_url))
|
|
104
117
|
@mock_repository.ingest
|
|
105
118
|
end
|
|
106
119
|
|
|
107
120
|
it "ingest with pid" do
|
|
108
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
121
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + object_url('mypid')))
|
|
109
122
|
@mock_repository.ingest :pid => 'mypid'
|
|
110
123
|
end
|
|
111
124
|
|
|
112
125
|
describe "export" do
|
|
113
126
|
it "should work on the happy path" do
|
|
114
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
127
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + export_object_url('mypid')))
|
|
115
128
|
@mock_repository.export :pid => 'mypid'
|
|
116
129
|
end
|
|
117
130
|
it "should require a pid" do
|
|
@@ -122,56 +135,68 @@ describe Rubydora::RestApiClient do
|
|
|
122
135
|
it "modify_object" do
|
|
123
136
|
RestClient::Request.should_receive(:execute) do |params|
|
|
124
137
|
params.should have_key(:url)
|
|
125
|
-
params[:url].should =~ /^#{Regexp.escape("
|
|
138
|
+
params[:url].should =~ /^#{Regexp.escape(base_url + "/" + object_url('mypid'))}.*state=Z/
|
|
126
139
|
end
|
|
127
140
|
@mock_repository.modify_object :pid => 'mypid', :state => 'Z'
|
|
128
141
|
end
|
|
129
142
|
|
|
130
143
|
it "purge_object" do
|
|
131
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
144
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + object_url('mypid')))
|
|
132
145
|
@mock_repository.purge_object :pid => 'mypid'
|
|
133
146
|
end
|
|
134
147
|
|
|
135
148
|
it "should raise not found exception when purging" do
|
|
136
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
149
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + object_url('mypid'))).and_raise( RestClient::ResourceNotFound)
|
|
137
150
|
lambda {@mock_repository.purge_object(:pid => 'mypid')}.should raise_error RestClient::ResourceNotFound
|
|
138
151
|
end
|
|
139
152
|
|
|
140
153
|
it "object_versions" do
|
|
141
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
154
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + object_versions_url('mypid', :format => 'xml')))
|
|
142
155
|
@mock_repository.object_versions :pid => 'mypid'
|
|
143
156
|
end
|
|
144
157
|
|
|
145
158
|
it "object_xml" do
|
|
146
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
159
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + object_xml_url('mypid', :format => 'xml')))
|
|
147
160
|
@mock_repository.object_xml :pid => 'mypid'
|
|
148
161
|
end
|
|
149
162
|
|
|
150
163
|
it "datastream" do
|
|
151
|
-
|
|
164
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastreams_url('mypid', :format => 'xml')))
|
|
152
165
|
logger.should_receive(:debug) # squelch message "Loaded datastream list for mypid (time)"
|
|
166
|
+
@mock_repository.datastreams :pid => 'mypid'
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
it "datastreams" do
|
|
170
|
+
@mock_repository.should_receive(:datastream).with(:pid => 'mypid', :dsid => 'asdf')
|
|
171
|
+
Deprecation.should_receive(:warn)
|
|
172
|
+
@mock_repository.datastreams :pid => 'mypid', :dsid => 'asdf'
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
it "datastream" do
|
|
176
|
+
@mock_repository.should_receive(:datastreams).with(:pid => 'mypid')
|
|
177
|
+
Deprecation.should_receive(:warn)
|
|
153
178
|
@mock_repository.datastream :pid => 'mypid'
|
|
154
179
|
end
|
|
155
180
|
|
|
156
181
|
it "datastream" do
|
|
157
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
182
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_url('mypid', 'aaa', :format => 'xml')))
|
|
158
183
|
logger.should_receive(:debug) # squelch message "Loaded datastream mypid/aaa (time)"
|
|
159
184
|
@mock_repository.datastream :pid => 'mypid', :dsid => 'aaa'
|
|
160
185
|
end
|
|
161
186
|
|
|
162
187
|
it "should raise not found exception when getting a datastream" do
|
|
163
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
188
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_url('mypid', 'aaa', :format => 'xml'))).and_raise( RestClient::ResourceNotFound)
|
|
164
189
|
lambda {@mock_repository.datastream :pid => 'mypid', :dsid => 'aaa'}.should raise_error RestClient::ResourceNotFound
|
|
165
190
|
end
|
|
166
191
|
|
|
167
192
|
it "should raise Unauthorized exception when getting a datastream" do
|
|
168
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
169
|
-
logger.should_receive(:error).with("Unauthorized at
|
|
193
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_url('mypid', 'aaa', :format => 'xml'))).and_raise( RestClient::Unauthorized)
|
|
194
|
+
logger.should_receive(:error).with("Unauthorized at #{base_url + "/" + datastream_url('mypid', 'aaa', :format => 'xml')}")
|
|
170
195
|
lambda {@mock_repository.datastream :pid => 'mypid', :dsid => 'aaa'}.should raise_error RestClient::Unauthorized
|
|
171
196
|
end
|
|
172
197
|
|
|
173
198
|
it "datastream_dissemination" do
|
|
174
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
199
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_content_url('mypid', 'aaa')))
|
|
175
200
|
@mock_repository.datastream_dissemination :pid => 'mypid', :dsid => 'aaa'
|
|
176
201
|
end
|
|
177
202
|
it "should allow http methods besides GET on datastream_dissemination" do
|
|
@@ -184,13 +209,13 @@ describe Rubydora::RestApiClient do
|
|
|
184
209
|
@mock_repository.datastream_dissemination :pid => 'mypid', :dsid => 'aaa', &_proc
|
|
185
210
|
end
|
|
186
211
|
it "should raise not found exception when retrieving datastream_dissemination" do
|
|
187
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
212
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_content_url('mypid', 'aaa'))).and_raise( RestClient::ResourceNotFound)
|
|
188
213
|
lambda {@mock_repository.datastream_dissemination :pid => 'mypid', :dsid => 'aaa'}.should raise_error RestClient::ResourceNotFound
|
|
189
214
|
end
|
|
190
215
|
|
|
191
216
|
describe "add_datastream" do
|
|
192
217
|
it "should post to the correct url" do
|
|
193
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
218
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_url('mypid', 'aaa')))
|
|
194
219
|
@mock_repository.add_datastream :pid => 'mypid', :dsid => 'aaa'
|
|
195
220
|
end
|
|
196
221
|
|
|
@@ -199,18 +224,18 @@ describe Rubydora::RestApiClient do
|
|
|
199
224
|
RestClient::Request.any_instance.should_receive(:transmit) #stub transmit so that Request.execute can close the file we pass
|
|
200
225
|
file = StringIO.new('test', 'r') # StringIO is a good stand it for a real File (it has read, rewind and close)
|
|
201
226
|
@mock_repository.add_datastream :pid => 'mypid', :dsid => 'aaa', :content=>file
|
|
202
|
-
lambda {file.read}.should_not raise_error
|
|
227
|
+
lambda {file.read}.should_not raise_error
|
|
203
228
|
end
|
|
204
229
|
end
|
|
205
230
|
end
|
|
206
231
|
|
|
207
232
|
describe "modify datastream" do
|
|
208
233
|
it "should not set mime-type when it's not provided" do
|
|
209
|
-
RestClient::Request.should_receive(:execute).with(:url => "
|
|
234
|
+
RestClient::Request.should_receive(:execute).with(:url => base_url + "/" + datastream_url('mypid', 'aaa'),:open_timeout=>nil, :payload=>nil, :user=>@fedora_user, :password=>@fedora_password, :method=>:put, :headers=>{})
|
|
210
235
|
@mock_repository.modify_datastream :pid => 'mypid', :dsid => 'aaa'
|
|
211
236
|
end
|
|
212
237
|
it "should pass the provided mimeType header" do
|
|
213
|
-
RestClient::Request.should_receive(:execute).with(:url => "
|
|
238
|
+
RestClient::Request.should_receive(:execute).with(:url => base_url + "/" + datastream_url('mypid', 'aaa', :mimeType => 'application/json'),:open_timeout=>nil, :payload=>nil, :user=>@fedora_user, :password=>@fedora_password, :method=>:put, :headers=>{})
|
|
214
239
|
@mock_repository.modify_datastream :pid => 'mypid', :dsid => 'aaa', :mimeType=>'application/json'
|
|
215
240
|
end
|
|
216
241
|
describe "when a file is passed" do
|
|
@@ -218,49 +243,49 @@ describe Rubydora::RestApiClient do
|
|
|
218
243
|
RestClient::Request.any_instance.should_receive(:transmit) #stub transmit so that Request.execute can close the file we pass
|
|
219
244
|
file = StringIO.new('test', 'r') # StringIO is a good stand it for a real File (it has read, rewind and close)
|
|
220
245
|
@mock_repository.modify_datastream :pid => 'mypid', :dsid => 'aaa', :content=>file
|
|
221
|
-
lambda {file.read}.should_not raise_error
|
|
246
|
+
lambda {file.read}.should_not raise_error
|
|
222
247
|
end
|
|
223
248
|
end
|
|
224
249
|
end
|
|
225
250
|
|
|
226
251
|
it "purge_datastream" do
|
|
227
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
252
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_url('mypid', 'aaa')))
|
|
228
253
|
@mock_repository.purge_datastream :pid => 'mypid', :dsid => 'aaa'
|
|
229
254
|
end
|
|
230
255
|
|
|
231
256
|
it "set_datastream_options" do
|
|
232
257
|
RestClient::Request.should_receive(:execute) do |params|
|
|
233
258
|
params.should have_key(:url)
|
|
234
|
-
params[:url].should =~ /^#{Regexp.escape("
|
|
259
|
+
params[:url].should =~ /^#{Regexp.escape(base_url + "/" + datastream_url('mypid', 'aaa') + "?")}.*aparam=true/
|
|
235
260
|
end
|
|
236
261
|
@mock_repository.set_datastream_options :pid => 'mypid', :dsid => 'aaa', :aparam => true
|
|
237
262
|
end
|
|
238
263
|
|
|
239
264
|
describe "datastream_versions" do
|
|
240
265
|
it "should be successful" do
|
|
241
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
266
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_history_url('mypid', 'aaa', :format=>'xml'))).and_return("expected result")
|
|
242
267
|
@mock_repository.datastream_versions(:pid => 'mypid', :dsid => 'aaa').should == 'expected result'
|
|
243
268
|
end
|
|
244
269
|
it "should not break when fedora doesn't have datastream history" do
|
|
245
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
270
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_history_url('mypid', 'aaa', :format=>'xml'))).and_raise(RestClient::ResourceNotFound)
|
|
246
271
|
@mock_repository.datastream_versions(:pid => 'mypid', :dsid => 'aaa').should be_nil
|
|
247
272
|
end
|
|
248
273
|
end
|
|
249
274
|
|
|
250
275
|
it "datastream_history" do
|
|
251
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
276
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + datastream_history_url('mypid', 'aaa', :format=>'xml')))
|
|
252
277
|
@mock_repository.datastream_history :pid => 'mypid', :dsid => 'aaa'
|
|
253
278
|
end
|
|
254
279
|
|
|
255
280
|
it "relationships" do
|
|
256
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
281
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + object_relationship_url('mypid', :format => 'xml')))
|
|
257
282
|
@mock_repository.relationships :pid => 'mypid'
|
|
258
283
|
end
|
|
259
284
|
|
|
260
285
|
it "add_relationship" do
|
|
261
286
|
RestClient::Request.should_receive(:execute) do |params|
|
|
262
287
|
params.should have_key(:url)
|
|
263
|
-
params[:url].should =~ /^#{Regexp.escape("
|
|
288
|
+
params[:url].should =~ /^#{Regexp.escape(base_url + "/" + new_object_relationship_url('mypid') + "?")}.*subject=z/
|
|
264
289
|
end
|
|
265
290
|
@mock_repository.add_relationship :pid => 'mypid', :subject => 'z'
|
|
266
291
|
end
|
|
@@ -268,23 +293,23 @@ describe Rubydora::RestApiClient do
|
|
|
268
293
|
it "purge_relationships" do
|
|
269
294
|
RestClient::Request.should_receive(:execute) do |params|
|
|
270
295
|
params.should have_key(:url)
|
|
271
|
-
params[:url].should =~ /^#{Regexp.escape("
|
|
296
|
+
params[:url].should =~ /^#{Regexp.escape(base_url + "/" + object_relationship_url('mypid') + "?")}.*subject=z/
|
|
272
297
|
end
|
|
273
298
|
@mock_repository.purge_relationship :pid => 'mypid', :subject => 'z'
|
|
274
299
|
end
|
|
275
300
|
|
|
276
301
|
it "dissemination" do
|
|
277
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
302
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + dissemination_url('mypid', nil, nil, :format => 'xml')))
|
|
278
303
|
@mock_repository.dissemination :pid => 'mypid'
|
|
279
304
|
end
|
|
280
305
|
|
|
281
306
|
it "dissemination" do
|
|
282
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
307
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + dissemination_url('mypid', 'sdef', nil, :format => 'xml')))
|
|
283
308
|
@mock_repository.dissemination :pid => 'mypid', :sdef => 'sdef'
|
|
284
309
|
end
|
|
285
310
|
|
|
286
311
|
it "dissemination" do
|
|
287
|
-
RestClient::Request.should_receive(:execute).with(hash_including(:url => "
|
|
312
|
+
RestClient::Request.should_receive(:execute).with(hash_including(:url => base_url + "/" + dissemination_url('mypid', 'sdef', 'method')))
|
|
288
313
|
@mock_repository.dissemination :pid => 'mypid', :sdef => 'sdef', :method => 'method'
|
|
289
314
|
end
|
|
290
315
|
|
|
@@ -4,8 +4,9 @@ describe Rubydora::Transactions do
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
subject {
|
|
7
|
-
Rubydora::Repository.any_instance.stub(:version).and_return(100)
|
|
8
|
-
repository = Rubydora::Repository.new :url => 'http://example.org'
|
|
7
|
+
# Rubydora::Repository.any_instance.stub(:version).and_return(100)
|
|
8
|
+
# repository = Rubydora::Repository.new :url => 'http://example.org'
|
|
9
|
+
Rubydora::Fc3Service.new :url => 'http://example.org'
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
describe "#transaction_is_redundant?" do
|
|
@@ -69,9 +70,8 @@ describe Rubydora::Transactions do
|
|
|
69
70
|
it "modify_object" do
|
|
70
71
|
subject.client.stub_chain(:[], :put).and_return 'asdf'
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
subject.should_receive(:
|
|
74
|
-
|
|
73
|
+
profile_xml = "<objectProfile><objState>A</objState><objOwnerId>567</objOwnerId></objectProfile>"
|
|
74
|
+
subject.should_receive(:object).with(pid: 'asdf').and_return profile_xml
|
|
75
75
|
|
|
76
76
|
subject.transaction do |t|
|
|
77
77
|
subject.modify_object :pid => 'asdf', :state => 'I', :ownerId => '123', :logMessage => 'changing asdf'
|
|
@@ -122,9 +122,8 @@ describe Rubydora::Transactions do
|
|
|
122
122
|
it "set_datastream_options" do
|
|
123
123
|
subject.client.stub_chain(:[], :put)
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
subject.should_receive(:find).with('asdf').and_return mock_object
|
|
125
|
+
profile_xml = "<datastreamProfile><dsVersionable>false</dsVersionable></datastreamProfile>"
|
|
126
|
+
subject.should_receive(:datastream).with(pid: 'asdf', dsid: 'mydsid').and_return profile_xml
|
|
128
127
|
|
|
129
128
|
subject.transaction do |t|
|
|
130
129
|
subject.set_datastream_options :pid => 'asdf', :dsid => 'mydsid', :versionable => true
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubydora
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Beer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2014-01-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fastercsv
|
|
@@ -112,16 +112,16 @@ dependencies:
|
|
|
112
112
|
name: hooks
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
|
-
- -
|
|
115
|
+
- - ~>
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
117
|
+
version: 0.3.0
|
|
118
118
|
type: :runtime
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
|
-
- -
|
|
122
|
+
- - ~>
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version:
|
|
124
|
+
version: 0.3.0
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
126
|
name: deprecation
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,20 +150,6 @@ dependencies:
|
|
|
150
150
|
- - '>='
|
|
151
151
|
- !ruby/object:Gem::Version
|
|
152
152
|
version: '0'
|
|
153
|
-
- !ruby/object:Gem::Dependency
|
|
154
|
-
name: shoulda
|
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
|
156
|
-
requirements:
|
|
157
|
-
- - '>='
|
|
158
|
-
- !ruby/object:Gem::Version
|
|
159
|
-
version: '0'
|
|
160
|
-
type: :development
|
|
161
|
-
prerelease: false
|
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
-
requirements:
|
|
164
|
-
- - '>='
|
|
165
|
-
- !ruby/object:Gem::Version
|
|
166
|
-
version: '0'
|
|
167
153
|
- !ruby/object:Gem::Dependency
|
|
168
154
|
name: bundler
|
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -243,21 +229,28 @@ extra_rdoc_files: []
|
|
|
243
229
|
files:
|
|
244
230
|
- .gitignore
|
|
245
231
|
- .gitmodules
|
|
232
|
+
- .mailmap
|
|
246
233
|
- .travis.yml
|
|
234
|
+
- CONTRIBUTING.md
|
|
247
235
|
- Gemfile
|
|
248
236
|
- History.textile
|
|
249
237
|
- LICENSE.txt
|
|
238
|
+
- Notices.txt
|
|
250
239
|
- README.rdoc
|
|
251
240
|
- Rakefile
|
|
252
241
|
- VERSION
|
|
242
|
+
- gemfiles/gemfile.rails3
|
|
243
|
+
- gemfiles/gemfile.rails4
|
|
253
244
|
- lib/rubydora.rb
|
|
254
245
|
- lib/rubydora/array_with_callback.rb
|
|
255
246
|
- lib/rubydora/audit_trail.rb
|
|
256
247
|
- lib/rubydora/callbacks.rb
|
|
257
248
|
- lib/rubydora/datastream.rb
|
|
258
249
|
- lib/rubydora/digital_object.rb
|
|
250
|
+
- lib/rubydora/fc3_service.rb
|
|
259
251
|
- lib/rubydora/fedora_url_helpers.rb
|
|
260
252
|
- lib/rubydora/models_mixin.rb
|
|
253
|
+
- lib/rubydora/profile_parser.rb
|
|
261
254
|
- lib/rubydora/relationships_mixin.rb
|
|
262
255
|
- lib/rubydora/repository.rb
|
|
263
256
|
- lib/rubydora/resource_index.rb
|
|
@@ -294,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
294
287
|
version: '0'
|
|
295
288
|
requirements: []
|
|
296
289
|
rubyforge_project:
|
|
297
|
-
rubygems_version: 2.
|
|
290
|
+
rubygems_version: 2.1.11
|
|
298
291
|
signing_key:
|
|
299
292
|
specification_version: 4
|
|
300
293
|
summary: Fedora Commons REST API ruby library
|