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.
@@ -2,14 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe Rubydora::DigitalObject do
4
4
  before do
5
- @mock_repository = mock(Rubydora::Repository, :config=>{})
5
+ @mock_repository = Rubydora::Fc3Service.new({})
6
6
  end
7
- describe "new" do
8
- it "should load a DigitalObject instance" do
9
- Rubydora::DigitalObject.new("pid").should be_a_kind_of(Rubydora::DigitalObject)
10
- end
11
- end
12
-
13
7
  describe "profile" do
14
8
  before(:each) do
15
9
  @object = Rubydora::DigitalObject.new 'pid', @mock_repository
@@ -46,28 +40,38 @@ describe Rubydora::DigitalObject do
46
40
  end
47
41
  end
48
42
 
49
- describe "new" do
43
+ describe "initialize" do
50
44
  before(:each) do
51
45
  @mock_repository.stub(:object) { raise RestClient::ResourceNotFound }
52
- @object = Rubydora::DigitalObject.new 'pid', @mock_repository
46
+ end
47
+ subject { Rubydora::DigitalObject.new 'pid', @mock_repository }
48
+
49
+ it "should load a DigitalObject instance" do
50
+ expect(subject).to be_a_kind_of(Rubydora::DigitalObject)
53
51
  end
54
52
 
55
53
  it "should be new" do
56
- @object.new?.should == true
54
+ expect(subject).to be_new
55
+ end
56
+
57
+ it "should be new_record" do
58
+ expect(subject).to be_new_record
57
59
  end
58
60
 
59
61
  it "should call ingest on save" do
60
- @object.stub(:datastreams) { {} }
61
- @mock_repository.should_receive(:ingest).with(hash_including(:pid => 'pid')).and_return('pid')
62
- @object.save
62
+ subject.stub(:datastreams) { {} }
63
+ expect(@mock_repository).to receive(:ingest).with(hash_including(:pid => 'pid')).and_return('pid')
64
+ subject.save
63
65
  end
64
66
 
65
- it "should create a new Fedora object with a generated PID if no PID is provided" do
66
- object = Rubydora::DigitalObject.new nil, @mock_repository
67
- @mock_repository.should_receive(:ingest).with(hash_including(:pid => nil)).and_return('pid')
68
- @mock_repository.should_receive(:datastreams).with(hash_including(:pid => 'pid')).and_raise(RestClient::ResourceNotFound)
69
- object.save
70
- object.pid.should == 'pid'
67
+ describe "without a provided pid" do
68
+ subject { Rubydora::DigitalObject.new nil, @mock_repository }
69
+ it "should create a new Fedora object with a generated PID if no PID is provided" do
70
+ @mock_repository.should_receive(:ingest).with(hash_including(:pid => nil)).and_return('pid')
71
+ @mock_repository.should_receive(:datastreams).with(hash_including(:pid => 'pid')).and_raise(RestClient::ResourceNotFound)
72
+ subject.save
73
+ subject.pid.should == 'pid'
74
+ end
71
75
  end
72
76
  end
73
77
 
@@ -92,7 +96,7 @@ describe Rubydora::DigitalObject do
92
96
  "<objectDatastreams><datastream dsid='a'></datastream>><datastream dsid='b'></datastream>><datastream dsid='c'></datastream></objectDatastreams>"
93
97
  end
94
98
  @object = Rubydora::DigitalObject.new 'pid', @mock_repository
95
- @object.stub(:new? => false)
99
+ @object.stub(:new_record? => false)
96
100
  end
97
101
 
98
102
  describe "datastreams" do
@@ -172,17 +176,17 @@ describe Rubydora::DigitalObject do
172
176
 
173
177
  describe "saving an object's datastreams" do
174
178
  before do
175
- @new_ds = mock(Rubydora::Datastream)
179
+ @new_ds = double(Rubydora::Datastream)
176
180
  @new_ds.stub(:new? => true, :changed? => true, :content_changed? => true, :content => 'XXX')
177
- @new_empty_ds = mock(Rubydora::Datastream)
181
+ @new_empty_ds = double(Rubydora::Datastream)
178
182
  @new_empty_ds.stub(:new? => true, :changed? => false, :content_changed? => false, :content => nil)
179
- @existing_ds = mock(Rubydora::Datastream)
183
+ @existing_ds = double(Rubydora::Datastream)
180
184
  @existing_ds.stub(:new? => false, :changed? => false, :content_changed? => false, :content => 'YYY')
181
- @changed_attr_ds = mock(Rubydora::Datastream)
185
+ @changed_attr_ds = double(Rubydora::Datastream)
182
186
  @changed_attr_ds.stub(:new? => false, :changed? => true, :content_changed? => false, :content => 'YYY')
183
- @changed_ds = mock(Rubydora::Datastream)
187
+ @changed_ds = double(Rubydora::Datastream)
184
188
  @changed_ds.stub(:new? => false, :changed? => true, :content_changed? => true, :content => 'ZZZ')
185
- @changed_empty_ds = mock(Rubydora::Datastream)
189
+ @changed_empty_ds = double(Rubydora::Datastream)
186
190
  @changed_empty_ds.stub(:new? => false, :changed? => true, :content_changed? => true, :content => nil)
187
191
 
188
192
  end
@@ -262,7 +266,7 @@ describe Rubydora::DigitalObject do
262
266
  end
263
267
 
264
268
  it "should remove models from fedora" do
265
- @object.should_receive(:profile).any_number_of_times.and_return({"objModels" => ['asdf']})
269
+ @object.stub(:profile).and_return({"objModels" => ['asdf']})
266
270
  @mock_repository.should_receive(:purge_relationship) do |params|
267
271
  params.should have_key(:subject)
268
272
  params[:predicate].should == 'info:fedora/fedora-system:def/model#hasModel'
@@ -272,7 +276,7 @@ describe Rubydora::DigitalObject do
272
276
  end
273
277
 
274
278
  it "should be able to handle complete model replacemenet" do
275
- @object.should_receive(:profile).any_number_of_times.and_return({"objModels" => ['asdf']})
279
+ @object.stub(:profile).and_return({"objModels" => ['asdf']})
276
280
  @mock_repository.should_receive(:add_relationship).with(instance_of(Hash))
277
281
  @mock_repository.should_receive(:purge_relationship).with(instance_of(Hash))
278
282
  @object.models = '1234'
@@ -301,7 +305,7 @@ describe Rubydora::DigitalObject do
301
305
  params[:predicate].should == 'info:fedora/fedora-system:def/relations-external#hasPart'
302
306
  params[:object].should == 'asdf'
303
307
  end
304
- @mock_object = mock(Rubydora::DigitalObject)
308
+ @mock_object = double(Rubydora::DigitalObject)
305
309
  @mock_object.should_receive(:fqpid).and_return('asdf')
306
310
  @mock_repository.should_receive(:find_by_sparql_relationship).with('info:fedora/pid', 'info:fedora/fedora-system:def/relations-external#hasPart').and_return([])
307
311
  @object.parts << @mock_object
@@ -313,7 +317,7 @@ describe Rubydora::DigitalObject do
313
317
  params[:predicate].should == 'info:fedora/fedora-system:def/relations-external#hasPart'
314
318
  params[:object].should == 'asdf'
315
319
  end
316
- @mock_object = mock(Rubydora::DigitalObject)
320
+ @mock_object = double(Rubydora::DigitalObject)
317
321
  @mock_object.should_receive(:fqpid).and_return('asdf')
318
322
  @mock_repository.should_receive(:find_by_sparql_relationship).with('info:fedora/pid', 'info:fedora/fedora-system:def/relations-external#hasPart').and_return([@mock_object])
319
323
  @object.parts.delete(@mock_object)
@@ -410,8 +414,53 @@ describe Rubydora::DigitalObject do
410
414
  end
411
415
 
412
416
  describe "#state" do
413
- it_behaves_like "an object attribute"
414
- let(:method) { 'state' }
417
+ subject { Rubydora::DigitalObject.new 'pid', @mock_repository }
418
+
419
+ describe "getter" do
420
+ it "should return the value" do
421
+ subject.instance_variable_set("@state", 'asdf')
422
+ subject.state.should == 'asdf'
423
+ end
424
+
425
+ it "should look in the object profile" do
426
+ subject.should_receive(:profile) { { Rubydora::DigitalObject::OBJ_ATTRIBUTES[:state].to_s => 'qwerty' } }
427
+ subject.state.should == 'qwerty'
428
+ end
429
+
430
+ it "should fall-back to the set of default attributes" do
431
+ @mock_repository.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
432
+ Rubydora::DigitalObject::OBJ_DEFAULT_ATTRIBUTES.should_receive(:[]).with(:state) { 'zxcv'}
433
+ subject.state.should == 'zxcv'
434
+ end
435
+ end
436
+
437
+ describe "setter" do
438
+ before do
439
+ subject.stub(:datastreams => [])
440
+ end
441
+ it "should mark the object as changed after setting" do
442
+ @mock_repository.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
443
+ subject.state= 'D'
444
+ subject.should be_changed
445
+ end
446
+
447
+ it "should raise an error when setting an invalid value" do
448
+ expect {subject.state= 'Q'}.to raise_error ArgumentError, "Allowed values for state are 'I', 'A' and 'D'. You provided 'Q'"
449
+ end
450
+
451
+ it "should not mark the object as changed if the value does not change" do
452
+ subject.should_receive(:state) { 'A' }
453
+ subject.state= 'A'
454
+ subject.should_not be_changed
455
+ end
456
+
457
+ it "should appear in the save request" do
458
+ @mock_repository.should_receive(:ingest).with(hash_including(:state => 'A'))
459
+ @mock_repository.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
460
+ subject.state='A'
461
+ subject.save
462
+ end
463
+ end
415
464
  end
416
465
 
417
466
  describe "#ownerId" do
@@ -433,4 +482,9 @@ describe Rubydora::DigitalObject do
433
482
  it_behaves_like "an object attribute"
434
483
  let(:method) { 'lastModifiedDate' }
435
484
  end
485
+
486
+ describe "#createdDate" do
487
+ it_behaves_like "an object attribute"
488
+ let(:method) { 'createdDate' }
489
+ end
436
490
  end
@@ -34,17 +34,17 @@ describe "Integration testing against a live Fedora repository", :integration =>
34
34
  end
35
35
 
36
36
  it "should create an object" do
37
- obj = Rubydora::DigitalObject.new('test:1', @repository)
37
+ obj = @repository.find_or_initialize('test:1')
38
38
  obj.new?.should == true
39
39
  obj.save
40
40
  obj.new?.should == false
41
41
  end
42
42
 
43
43
  it "new should not return true until the profile is read" do
44
- obj = Rubydora::DigitalObject.new('test:1', @repository)
44
+ obj = @repository.find_or_initialize('test:1')
45
45
  obj.save
46
- new_obj = Rubydora::DigitalObject.new('test:1', @repository)
47
- new_obj.new?.should == false
46
+ obj = @repository.find('test:1')
47
+ obj.should_not be_new
48
48
  end
49
49
 
50
50
  it "should have default datastreams" do
@@ -58,13 +58,13 @@ describe "Integration testing against a live Fedora repository", :integration =>
58
58
  end
59
59
 
60
60
  it "should create another object" do
61
- obj = Rubydora::DigitalObject.new('test:2', @repository)
61
+ obj = @repository.find_or_initialize('test:2')
62
62
  obj.save
63
63
  obj.new?.should == false
64
64
  end
65
65
 
66
66
  it "should create and update object labels" do
67
- obj = Rubydora::DigitalObject.new('test:3', @repository)
67
+ obj = @repository.find_or_initialize('test:3')
68
68
  obj.label = 'asdf'
69
69
  obj.save
70
70
 
@@ -78,12 +78,10 @@ describe "Integration testing against a live Fedora repository", :integration =>
78
78
 
79
79
  end
80
80
 
81
- it "should persist parts" do
82
- obj = @repository.find('test:1')
83
- end
81
+ describe "datastream stuff" do
84
82
 
85
83
  it "should create a managed datastream" do
86
- obj = @repository.find('test:1')
84
+ obj = @repository.find_or_initialize('test:1')
87
85
  obj.save
88
86
  ds = obj.datastreams["Test"]
89
87
 
@@ -93,7 +91,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
93
91
  end
94
92
 
95
93
  it "should create a redirect datastream" do
96
- obj = @repository.find('test:1')
94
+ obj = @repository.find_or_initialize('test:1')
97
95
  ds = obj.datastreams["Redirect"]
98
96
  ds.controlGroup = "R"
99
97
  ds.dsLocation = "http://example.org"
@@ -101,7 +99,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
101
99
  end
102
100
 
103
101
  it "should have datastreams" do
104
- obj = @repository.find('test:1')
102
+ obj = @repository.find_or_initialize('test:1')
105
103
  obj.datastreams.keys.should include("Test")
106
104
  obj.datastreams.keys.should include("Redirect")
107
105
  end
@@ -112,7 +110,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
112
110
  end
113
111
 
114
112
  it "should have profile attributes" do
115
- obj = @repository.find('test:1')
113
+ obj = @repository.find_or_initialize('test:1')
116
114
  ds = obj.datastreams["Test"]
117
115
 
118
116
  ds.versionID.should == "Test.0"
@@ -122,15 +120,16 @@ describe "Integration testing against a live Fedora repository", :integration =>
122
120
  ds.controlGroup.should == "M"
123
121
  ds.size.should be > 100
124
122
  end
123
+ end
125
124
 
126
125
  it "should delete datastreams" do
127
- obj = @repository.find('test:1')
126
+ obj = @repository.find_or_initialize('test:1')
128
127
  ds = obj.datastreams["Test"].delete
129
128
  obj.datastreams.keys.should_not include("Test")
130
129
  end
131
130
 
132
131
  it "should save changed datastreams when the object is saved" do
133
- obj = Rubydora::DigitalObject.new('test:1', @repository)
132
+ obj = @repository.find_or_initialize('test:1')
134
133
  obj.datastreams["new_ds"].content = "XXX"
135
134
  obj.datastreams["empty_ds"].new?
136
135
  obj.save
@@ -140,7 +139,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
140
139
  end
141
140
 
142
141
  it "should update datastream attributes without changing the content (or mime type)" do
143
- obj = Rubydora::DigitalObject.new('test:1', @repository)
142
+ obj = @repository.find_or_initialize('test:1')
144
143
  obj.datastreams["my_ds"].content = "XXX"
145
144
  obj.datastreams["my_ds"].mimeType = "application/x-text"
146
145
  obj.save
@@ -156,7 +155,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
156
155
  end
157
156
 
158
157
  it "should save IO-based datastreams" do
159
- obj = @repository.find('test:1')
158
+ obj = @repository.find_or_initialize('test:1')
160
159
  ds = obj.datastreams['gemspec']
161
160
  ds.controlGroup = 'M'
162
161
  ds.content = File.open('rubydora.gemspec', 'r')
@@ -170,7 +169,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
170
169
  @repository.find('transactions:1').delete rescue nil
171
170
 
172
171
  @repository.transaction do |t|
173
- obj = Rubydora::DigitalObject.new('transactions:1', @repository)
172
+ obj = @repository.find_or_initialize('transactions:1')
174
173
  obj.save
175
174
 
176
175
  t.rollback
@@ -182,7 +181,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
182
181
  it "should work on purge" do
183
182
  @repository.find('transactions:1').delete rescue nil
184
183
 
185
- obj = Rubydora::DigitalObject.new('transactions:1', @repository)
184
+ obj = @repository.find_or_initialize('transactions:1')
186
185
  obj.save
187
186
 
188
187
  @repository.transaction do |t|
@@ -239,9 +238,10 @@ describe "Integration testing against a live Fedora repository", :integration =>
239
238
  end
240
239
 
241
240
  it "should work on relationships" do
241
+ pending("fcrepo 3.6's relationship api is busted; skipping") if @repository.version == 3.6
242
242
  @repository.find('transactions:1').delete rescue nil
243
243
 
244
- obj = Rubydora::DigitalObject.new('transactions:1', @repository)
244
+ obj = @repository.find_or_initialize('transactions:1')
245
245
  obj.save
246
246
  @repository.add_relationship :subject => obj.pid, :predicate => 'uri:asdf', :object => 'fedora:object'
247
247
 
@@ -266,7 +266,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
266
266
  end
267
267
 
268
268
  it "should have read-only versions" do
269
- obj = Rubydora::DigitalObject.new('test:1', @repository)
269
+ obj = @repository.find_or_initialize('test:1')
270
270
  expect { obj.versions.first.label = "asdf" }.to raise_error
271
271
  end
272
272
 
@@ -285,7 +285,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
285
285
  #end
286
286
 
287
287
  it "should access datastreams list using asOfDateTime (and pass the asOfDateTime through to the datastreams)" do
288
- obj = Rubydora::DigitalObject.new('test:1', @repository)
288
+ obj = @repository.find_or_initialize('test:1')
289
289
  oldest = obj.versions.first.datastreams.keys
290
290
  newest = obj.versions.last.datastreams.keys
291
291
  (newest - oldest).should_not be_empty
@@ -297,21 +297,21 @@ describe "Integration testing against a live Fedora repository", :integration =>
297
297
  describe "datastream versions" do
298
298
 
299
299
  it "should have versions" do
300
- obj = Rubydora::DigitalObject.new('test:1', @repository)
300
+ obj = @repository.find_or_initialize('test:1')
301
301
  versions = obj.datastreams["my_ds"].versions
302
302
  versions.should_not be_empty
303
303
  versions.map { |x| x.versionID }.should include('my_ds.1', 'my_ds.0')
304
304
  end
305
305
 
306
306
  it "should have read-only versions" do
307
- obj = Rubydora::DigitalObject.new('test:1', @repository)
307
+ obj = @repository.find_or_initialize('test:1')
308
308
  ds = obj.datastreams["my_ds"].asOfDateTime(Time.now)
309
309
  expect { ds.dsLabel = 'asdf' }.to raise_error
310
310
  expect { ds.content = 'asdf' }.to raise_error
311
311
  end
312
312
 
313
313
  it "should access the content of older datastreams" do
314
- obj = Rubydora::DigitalObject.new('test:1', @repository)
314
+ obj = @repository.find_or_initialize('test:1')
315
315
 
316
316
  ds = obj.datastreams["my_ds"]
317
317
  ds.content = "YYY"
@@ -322,7 +322,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
322
322
  end
323
323
 
324
324
  it "should allow the user to go from a versioned datastream to an unversioned datastream" do
325
- obj = Rubydora::DigitalObject.new('test:1', @repository)
325
+ obj = @repository.find_or_initialize('test:1')
326
326
  versions_count = obj.datastreams["my_ds"].versions.length
327
327
 
328
328
  obj.datastreams["my_ds"].versionable.should be_true
@@ -345,12 +345,12 @@ describe "Integration testing against a live Fedora repository", :integration =>
345
345
 
346
346
  context "mime types" do
347
347
  before(:each) do
348
- obj = @repository.find('test:1')
348
+ obj = @repository.find_or_initialize('test:1')
349
349
  obj.datastreams["my_ds"].delete rescue nil
350
350
  end
351
351
 
352
352
  it "should default to application/octet-stream" do
353
- obj = Rubydora::DigitalObject.new('test:1', @repository)
353
+ obj = @repository.find_or_initialize('test:1')
354
354
  obj.datastreams["my_ds"].content = "XXX"
355
355
  obj.save
356
356
 
@@ -359,7 +359,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
359
359
  end
360
360
 
361
361
  it "should allow the user to specify a mimetype" do
362
- obj = Rubydora::DigitalObject.new('test:1', @repository)
362
+ obj = @repository.find_or_initialize('test:1')
363
363
  obj.datastreams["my_ds"].content = "XXX"
364
364
  obj.datastreams["my_ds"].mimeType = "text/plain"
365
365
  obj.save
@@ -369,7 +369,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
369
369
  end
370
370
 
371
371
  it "should preserve the mimetype on update" do
372
- obj = Rubydora::DigitalObject.new('test:1', @repository)
372
+ obj = @repository.find_or_initialize('test:1')
373
373
  obj.datastreams["my_ds"].content = "XXX"
374
374
  obj.datastreams["my_ds"].mimeType = "text/plain"
375
375
  obj.save
@@ -383,7 +383,7 @@ describe "Integration testing against a live Fedora repository", :integration =>
383
383
  end
384
384
 
385
385
  it "should allow the mimetype to be changed" do
386
- obj = @repository.find('test:1')
386
+ obj = @repository.find_or_initialize('test:1')
387
387
  obj.datastreams["my_ds"].content = "XXX"
388
388
  obj.datastreams["my_ds"].mimeType = "text/plain"
389
389
  obj.save
@@ -1,8 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Rubydora::Repository do
4
+ include Rubydora::FedoraUrlHelpers
5
+
4
6
  before(:each) do
5
- @repository = Rubydora::Repository.new
7
+ @repository = Rubydora::Repository.new
6
8
  end
7
9
 
8
10
  describe "initialize" do
@@ -22,13 +24,24 @@ describe Rubydora::Repository do
22
24
 
23
25
  describe "find" do
24
26
  it "should load objects by pid" do
25
- @mock_object = mock(Rubydora::DigitalObject)
27
+ @mock_object = double(Rubydora::DigitalObject)
26
28
  Rubydora::DigitalObject.should_receive(:find).with("pid", instance_of(Rubydora::Repository)).and_return @mock_object
27
29
 
28
30
  @repository.find('pid')
29
31
  end
30
32
  end
31
33
 
34
+ describe "mint" do
35
+ before do
36
+ xml = "<resp xmlns:fedora=\"http://www.fedora.info/definitions/1/0/management/\"><fedora:pid>test:123</fedora:pid></resp>"
37
+ @repository.api.should_receive(:next_pid).and_return xml
38
+ end
39
+ it "should call nextPID" do
40
+ @repository.mint.should == 'test:123'
41
+ end
42
+ end
43
+
44
+
32
45
  describe "sparql" do
33
46
  it "should return csv results for sparql queries" do
34
47
  resource_index_query = ""
@@ -40,13 +53,13 @@ describe Rubydora::Repository do
40
53
 
41
54
  describe "profile" do
42
55
  it "should map the fedora repository description to a hash" do
43
- @mock_response = mock()
44
- @mock_client = mock(RestClient::Resource)
56
+ @mock_response = double
57
+ @mock_client = double
58
+ @repository.api.should_receive(:client).and_return(@mock_client)
59
+ @mock_client.should_receive(:[]).with(describe_repository_url(:xml=> true)).and_return(@mock_response)
45
60
  @mock_response.should_receive(:get).and_return <<-XML
46
61
  <?xml version="1.0" encoding="UTF-8"?><fedoraRepository xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fedora.info/definitions/1/0/access/ http://www.fedora.info/definitions/1/0/fedoraRepository.xsd"><repositoryName>Fedora Repository</repositoryName><repositoryBaseURL>http://localhost:8983/fedora</repositoryBaseURL><repositoryVersion>3.3</repositoryVersion><repositoryPID> <PID-namespaceIdentifier>changeme</PID-namespaceIdentifier> <PID-delimiter>:</PID-delimiter> <PID-sample>changeme:100</PID-sample> <retainPID>*</retainPID></repositoryPID><repositoryOAI-identifier> <OAI-namespaceIdentifier>example.org</OAI-namespaceIdentifier> <OAI-delimiter>:</OAI-delimiter> <OAI-sample>oai:example.org:changeme:100</OAI-sample></repositoryOAI-identifier><sampleSearch-URL>http://localhost:8983/fedora/search</sampleSearch-URL><sampleAccess-URL>http://localhost:8983/fedora/get/demo:5</sampleAccess-URL><sampleOAI-URL>http://localhost:8983/fedora/oai?verb=Identify</sampleOAI-URL><adminEmail>bob@example.org</adminEmail><adminEmail>sally@example.org</adminEmail></fedoraRepository>
47
62
  XML
48
- @mock_client.should_receive(:[]).with('describe?xml=true').and_return(@mock_response)
49
- @repository.should_receive(:client).and_return(@mock_client)
50
63
  profile = @repository.profile
51
64
  profile['repositoryVersion'].should == '3.3'
52
65
  end
@@ -18,8 +18,8 @@ describe Rubydora::ResourceIndex do
18
18
  end
19
19
 
20
20
  it "should send sparql queries with appropriate parameters" do
21
- @mock_risearch = mock()
22
- @mock_client = mock(RestClient::Resource)
21
+ @mock_risearch = double()
22
+ @mock_client = double(RestClient::Resource)
23
23
  @mock_risearch.should_receive(:post).with(hash_including(:dt => 'on', :format => 'CSV', :lang => 'sparql', :limit => nil, :query => 'placeholder SPARQL query', :type => 'tuples' ))
24
24
  @mock_client.should_receive(:[]).with('risearch').and_return(@mock_risearch)
25
25
  @mock_repository.should_receive(:client).and_return(@mock_client)