rubydora 1.8.1 → 1.9.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.
@@ -1,6 +1,6 @@
1
1
  module Rubydora
2
2
  # Extremely basic (and naive) 'transaction' support for Rubydora. This isn't
3
- # really intended to be used in a production-like situation -- more for
3
+ # really intended to be used in a production-like situation -- more for
4
4
  # rolling back (small) changes during testing.
5
5
  module Transactions
6
6
  extend ActiveSupport::Concern
@@ -62,10 +62,9 @@ module Rubydora
62
62
  end
63
63
 
64
64
  end
65
-
66
65
 
67
66
  # Start a transaction
68
- def transaction &block
67
+ def transaction(&block)
69
68
  Transaction.new self, &block
70
69
  self.transactions_log.clear
71
70
  end
@@ -73,13 +72,11 @@ module Rubydora
73
72
  # Unshift a transaction entry onto the transaction logs.
74
73
  # We want these entries in reverse-chronological order
75
74
  # for ease of undoing..
76
- def append_to_transactions_log method, options = {}
75
+ def append_to_transactions_log(method, options = {})
77
76
  return unless Rubydora::Transactions.use_transactions
78
-
79
- unless transaction_is_redundant?(method, options)
80
- options[:foxml] = export(:pid => options[:pid], :context => :archive) if options[:foxml] == true
81
- transactions_log.unshift([method, options])
82
- end
77
+ return if transaction_is_redundant?(method, options)
78
+ options[:foxml] = export(:pid => options[:pid], :context => :archive) if options[:foxml] == true
79
+ transactions_log.unshift([method, options])
83
80
  end
84
81
 
85
82
  # The repository transaction log.
@@ -87,12 +84,11 @@ module Rubydora
87
84
  @log ||= []
88
85
  end
89
86
 
90
- def transaction_is_redundant? method, options
91
- return true if transactions_log.any? { |(t_method, t_options)|
87
+ def transaction_is_redundant?(method, options)
88
+ return true if transactions_log.any? { |(t_method, t_options)|
92
89
  # these methods will rollback ANY object change that happens after it, so there's no need to track future changes to this object
93
- t_options[:pid] == options[:pid] and [:ingest, :purge_object, :modify_datastream, :purge_datastream].include? t_method
90
+ t_options[:pid] == options[:pid] && [:ingest, :purge_object, :modify_datastream, :purge_datastream].include?(t_method)
94
91
  }
95
-
96
92
  false
97
93
  end
98
94
  end
@@ -102,74 +98,69 @@ module Rubydora
102
98
  include Hooks
103
99
  define_hook :after_rollback
104
100
 
105
- def initialize repository, &block
101
+ def initialize(repository, &block)
106
102
  @repository = repository
107
103
  with_transactions(&block)
108
104
  end
109
105
 
110
- def with_transactions &block
106
+ def with_transactions(&block)
111
107
  old_state = Rubydora::Transactions.use_transactions
112
108
  Rubydora::Transactions.use_transactions = true
113
-
114
109
  yield(self)
115
-
116
110
  Rubydora::Transactions.use_transactions = old_state
117
111
  end
118
112
 
119
- def without_transactions &block
113
+ def without_transactions(&block)
120
114
  old_state = Rubydora::Transactions.use_transactions
121
115
  Rubydora::Transactions.use_transactions = false
122
-
123
116
  yield(self)
124
-
125
117
  Rubydora::Transactions.use_transactions = old_state
126
118
  end
127
119
 
128
- # Roll-back transactions by reversing their outcomes
129
- # (or, in some cases, re-ingesting the object at the
120
+ # Roll-back transactions by reversing their outcomes
121
+ # (or, in some cases, re-ingesting the object at the
130
122
  # previous state.
131
123
  def rollback
132
124
  without_transactions do
133
- repository.transactions_log.delete_if do |(method, options)|
125
+ repository.transactions_log.delete_if do |(method, options)|
134
126
 
135
- begin
136
- case method
137
- when :ingest
138
- repository.purge_object :pid => options[:pid]
127
+ begin
128
+ case method
129
+ when :ingest
130
+ repository.purge_object :pid => options[:pid]
139
131
 
140
- when :modify_object
141
- repository.modify_object options
132
+ when :modify_object
133
+ repository.modify_object options
142
134
 
143
- when :add_datastream
144
- repository.purge_datastream :pid => options[:pid], :dsid => options[:dsid]
135
+ when :add_datastream
136
+ repository.purge_datastream :pid => options[:pid], :dsid => options[:dsid]
145
137
 
146
- when :add_relationship
147
- repository.purge_relationship options[:options].merge(:pid => options[:pid])
138
+ when :add_relationship
139
+ repository.purge_relationship options[:options].merge(:pid => options[:pid])
148
140
 
149
- when :purge_relationship
150
- repository.add_relationship options[:options].merge(:pid => options[:pid])
141
+ when :purge_relationship
142
+ repository.add_relationship options[:options].merge(:pid => options[:pid])
151
143
 
152
- when :purge_object
153
- repository.ingest :pid => options[:pid], :file => options[:foxml]
144
+ when :purge_object
145
+ repository.ingest :pid => options[:pid], :file => options[:foxml]
154
146
 
155
- when :set_datastream_options
156
- repository.set_datastream_options options
147
+ when :set_datastream_options
148
+ repository.set_datastream_options options
157
149
 
158
- when :modify_datastream
159
- repository.purge_object :pid => options[:pid] rescue nil
160
- repository.ingest :pid => options[:pid], :file => options[:foxml]
150
+ when :modify_datastream
151
+ repository.purge_object :pid => options[:pid] rescue nil
152
+ repository.ingest :pid => options[:pid], :file => options[:foxml]
161
153
 
162
- when :purge_datastream
163
- repository.purge_object :pid => options[:pid] rescue nil
164
- repository.ingest :pid => options[:pid], :file => options[:foxml]
154
+ when :purge_datastream
155
+ repository.purge_object :pid => options[:pid] rescue nil
156
+ repository.ingest :pid => options[:pid], :file => options[:foxml]
157
+ end
158
+ rescue
159
+ # no-op
165
160
  end
166
- rescue
167
- # no-op
168
- end
169
-
170
- run_hook :after_rollback, :pid => options[:pid], :method => method, :options => options
171
161
 
172
- end
162
+ run_hook :after_rollback, :pid => options[:pid], :method => method, :options => options
163
+ end
173
164
  end
174
165
  true
175
166
  end
@@ -1,35 +1,35 @@
1
1
  # Provide a simple gemspec so you can easily use your enginex
2
2
  # project in your rails apps through git.
3
- require File.join(File.dirname(__FILE__), "lib/rubydora/version")
3
+ require File.join(File.dirname(__FILE__), 'lib/rubydora/version')
4
4
  Gem::Specification.new do |s|
5
- s.name = "rubydora"
6
- s.version = Rubydora::VERSION
7
- s.platform = Gem::Platform::RUBY
8
- s.authors = ["Chris Beer"]
9
- s.email = ["chris@cbeer.info"]
10
- s.summary = %q{Fedora Commons REST API ruby library }
11
- s.description = %q{Fedora Commons REST API ruby library}
12
- s.homepage = "http://github.com/projecthydra/rubydora"
5
+ s.name = 'rubydora'
6
+ s.version = Rubydora::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ['Chris Beer']
9
+ s.email = ['chris@cbeer.info']
10
+ s.summary = 'Fedora Commons REST API ruby library'
11
+ s.description = 'Fedora Commons REST API ruby library'
12
+ s.homepage = 'http://github.com/projecthydra/rubydora'
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
- s.require_paths = ["lib"]
17
+ s.require_paths = ['lib']
18
18
 
19
- s.add_dependency "fastercsv"
20
- s.add_dependency "rest-client"
21
- s.add_dependency "nokogiri"
22
- s.add_dependency "equivalent-xml"
23
- s.add_dependency "mime-types"
24
- s.add_dependency "activesupport"
25
- s.add_dependency "activemodel"
26
- s.add_dependency "hooks", "~> 0.3.0"
27
- s.add_dependency "deprecation"
19
+ s.add_dependency 'rest-client'
20
+ s.add_dependency 'nokogiri'
21
+ s.add_dependency 'equivalent-xml'
22
+ s.add_dependency 'mime-types'
23
+ s.add_dependency 'activesupport'
24
+ s.add_dependency 'activemodel'
25
+ s.add_dependency 'hooks', '~> 0.3'
26
+ s.add_dependency 'deprecation'
28
27
 
29
- s.add_development_dependency("rake")
30
- s.add_development_dependency("bundler", ">= 1.0.14")
31
- s.add_development_dependency("rspec", "~> 2.0")
32
- s.add_development_dependency("yard")
33
- s.add_development_dependency("jettywrapper", ">= 1.4.0")
34
- s.add_development_dependency("webmock")
28
+ s.add_development_dependency 'rake'
29
+ s.add_development_dependency 'yard'
30
+ s.add_development_dependency 'bundler', '>= 1.0.14'
31
+ s.add_development_dependency 'rspec', '~> 2.0'
32
+ s.add_development_dependency 'jettywrapper', '>= 1.4.0'
33
+ s.add_development_dependency 'webmock'
34
+ s.add_development_dependency 'simplecov'
35
35
  end
@@ -24,5 +24,5 @@ describe "#audit_trail" do
24
24
  record.date.should == "2013-02-25T16:43:06.219Z"
25
25
  record.justification.should == ""
26
26
  end
27
-
27
+
28
28
  end
@@ -28,7 +28,7 @@ describe Rubydora::Datastream do
28
28
  stub_response = double
29
29
  stub_response.stub(:read_body).and_yield("one1").and_yield('two2').and_yield('thre').and_yield('four')
30
30
  allow(stub_response).to receive(:headers) { {content_length: "16"} }
31
- @mock_api.should_receive(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_yield(stub_response)
31
+ @mock_api.should_receive(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_yield(stub_response)
32
32
  subject.profile = Rubydora::ProfileParser.parse_datastream_profile(prof)
33
33
  end
34
34
  shared_examples "a streamable datastream" do
@@ -166,7 +166,6 @@ describe Rubydora::Datastream do
166
166
  # @datastream.versionable.should be true
167
167
  # end
168
168
 
169
-
170
169
  it "should call the appropriate api on save" do
171
170
  @datastream.stub(:content => 'content')
172
171
  @mock_api.should_receive(:add_datastream).with(hash_including(:content => 'content', :pid => 'pid', :dsid => 'dsid', :controlGroup => 'M', :dsState => 'A'))
@@ -221,7 +220,7 @@ describe Rubydora::Datastream do
221
220
  <datastreamProfile>
222
221
  </datastreamProfile>
223
222
  XML
224
- @datastream.dsChecksumValid.should be_nil
223
+ @datastream.dsChecksumValid.should be_nil
225
224
  end
226
225
 
227
226
  it "should be true when it's returned as true" do
@@ -268,7 +267,7 @@ describe Rubydora::Datastream do
268
267
  end
269
268
 
270
269
  it "should mediate access to datastream contents" do
271
- @mock_api.should_receive(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('asdf')
270
+ @mock_api.should_receive(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('asdf')
272
271
  @datastream.content.should == "asdf"
273
272
  end
274
273
 
@@ -288,7 +287,6 @@ describe Rubydora::Datastream do
288
287
 
289
288
  end
290
289
 
291
-
292
290
  end
293
291
 
294
292
  describe "content changed behavior" do
@@ -303,8 +301,13 @@ describe Rubydora::Datastream do
303
301
  XML
304
302
  end
305
303
 
304
+ it "does not retrieve content unnecessarily" do
305
+ @mock_api.should_not_receive(:datastream_dissemination)
306
+ @datastream.content_changed?.should == false
307
+ end
308
+
306
309
  it "should not be changed after a read-only access" do
307
- @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('asdf')
310
+ @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('asdf')
308
311
  @datastream.content
309
312
  @datastream.content_changed?.should == false
310
313
  end
@@ -313,29 +316,29 @@ describe Rubydora::Datastream do
313
316
  @datastream.content_changed?.should == false
314
317
  end
315
318
  it "should be changed when the new content is different than the old content" do
316
- @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('asdf')
319
+ @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('asdf')
317
320
  @datastream.content = "test"
318
- @datastream.content_changed?.should == true
321
+ @datastream.content_changed?.should == true
319
322
  end
320
323
 
321
324
  it "should not be changed when the new content is the same as the existing content (when eager-loading is enabled)" do
322
- @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('test')
325
+ @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('test')
323
326
  @datastream.eager_load_datastream_content = true
324
327
  @datastream.content = "test"
325
- @datastream.content_changed?.should == false
328
+ @datastream.content_changed?.should == false
326
329
  end
327
330
 
328
331
  it "should be changed when the new content is the same as the existing content (without eager loading, the default)" do
329
- @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('test')
332
+ @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('test')
330
333
  @datastream.content = "test"
331
334
  @datastream.content_changed?.should == true
332
335
  end
333
336
 
334
337
  it "should not be changed when the new content is the same as the existing content (and we have accessed #content previously)" do
335
- @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('test')
338
+ @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('test')
336
339
  @datastream.content
337
340
  @datastream.content = "test"
338
- @datastream.content_changed?.should == false
341
+ @datastream.content_changed?.should == false
339
342
  end
340
343
  end
341
344
 
@@ -350,14 +353,14 @@ describe Rubydora::Datastream do
350
353
  @datastream = Rubydora::Datastream.new @mock_object, 'dsid', :controlGroup => 'X'
351
354
  end
352
355
  it "should not be changed when the new content is the same as the existing content (when eager-loading is enabled)" do
353
- @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('<xml>test</xml>')
356
+ @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('<xml>test</xml>')
354
357
  @datastream.eager_load_datastream_content = true
355
358
  @datastream.content = "<xml>test</xml>"
356
- @datastream.content_changed?.should == false
359
+ @datastream.content_changed?.should == false
357
360
  end
358
361
 
359
362
  it "should be changed when the new content is the same as the existing content (without eager loading, the default)" do
360
- @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('<xml>test</xml>')
363
+ @mock_api.stub(:datastream_dissemination).with(hash_including(:pid => 'pid', :dsid => 'dsid')).and_return('<xml>test</xml>')
361
364
  @datastream.content = "<xml>test</xml>"
362
365
  @datastream.content_changed?.should == true
363
366
  end
@@ -372,12 +375,12 @@ describe Rubydora::Datastream do
372
375
  subject { Rubydora::Datastream.new double(:pid => 'asdf', :new? => false), 'asdf' }
373
376
  it "should have content if it is persisted" do
374
377
  subject.stub(:new? => false)
375
- subject.should have_content
378
+ subject.should have_content
376
379
  end
377
380
 
378
381
  it "should have content if it has content" do
379
382
  subject.content = "123"
380
- subject.should have_content
383
+ subject.should have_content
381
384
  end
382
385
 
383
386
  context "it has a dsLocation" do
@@ -398,7 +401,7 @@ describe Rubydora::Datastream do
398
401
 
399
402
  it "should not have content otherwise" do
400
403
  subject.stub(:content => nil)
401
- subject.should_not have_content
404
+ subject.should_not have_content
402
405
  end
403
406
  end
404
407
 
@@ -561,7 +564,7 @@ describe Rubydora::Datastream do
561
564
  end
562
565
 
563
566
  end
564
-
567
+
565
568
  end
566
569
 
567
570
  describe "datastream attributes" do
@@ -609,11 +612,11 @@ describe Rubydora::Datastream do
609
612
  subject.send("#{method}=", 'zxcv')
610
613
  end
611
614
 
612
- it "should appear in the save request" do
613
- @mock_api.should_receive(:modify_datastream).with(hash_including(method.to_sym => 'new_value'))
614
- subject.send("#{method}=", 'new_value')
615
- subject.save
616
- expect(subject).to_not be_changed, "#{subject.changes.inspect}"
615
+ it "should appear in the save request" do
616
+ @mock_api.should_receive(:modify_datastream).with(hash_including(method.to_sym => 'new_value'))
617
+ subject.send("#{method}=", 'new_value')
618
+ subject.save
619
+ expect(subject).to_not be_changed, "#{subject.changes.inspect}"
617
620
  end
618
621
  end
619
622
  end
@@ -657,10 +660,10 @@ describe Rubydora::Datastream do
657
660
  end
658
661
 
659
662
  it "should appear in the save request" do
660
- @mock_api.should_receive(:modify_datastream).with(hash_including(method.to_sym => 'http://example.com'))
661
- subject.stub(:content_changed? => false)
662
- subject.dsLocation = 'http://example.com'
663
- subject.save
663
+ @mock_api.should_receive(:modify_datastream).with(hash_including(method.to_sym => 'http://example.com'))
664
+ subject.stub(:content_changed? => false)
665
+ subject.dsLocation = 'http://example.com'
666
+ subject.save
664
667
  end
665
668
  end
666
669
 
@@ -829,12 +832,12 @@ describe Rubydora::Datastream do
829
832
  end
830
833
  end
831
834
 
832
-
833
835
  describe "without existing properties" do
834
836
  before(:each) do
835
837
  @datastream = Rubydora::Datastream.new @mock_object, 'dsid'
836
838
  @datastream.stub(:new? => true )
837
839
  @datastream.stub(:local_or_remote_content => '123')
840
+ @datastream.stub(:content_loaded? => true)
838
841
  @datastream.stub(:profile) { {} }
839
842
  end
840
843
  it "should compile parameters to hash" do
@@ -880,7 +883,7 @@ describe Rubydora::Datastream do
880
883
  after(:all) do
881
884
  Object.send(:remove_const, :MyDatastream)
882
885
  end
883
-
886
+
884
887
  describe "saving new datastream" do
885
888
  before do
886
889
  allow(@mock_api).to receive(:add_datastream).with(hash_including(:content => 'content', :pid => 'pid', :dsid => 'dsid', :controlGroup => 'M', :dsState => 'A')) { {} }
@@ -913,4 +916,3 @@ describe Rubydora::Datastream do
913
916
  end
914
917
 
915
918
  end
916
-
@@ -68,7 +68,7 @@ describe Rubydora::DigitalObject do
68
68
 
69
69
  describe "without a provided pid" do
70
70
  subject { Rubydora::DigitalObject.new nil, @mock_api }
71
- it "should create a new Fedora object with a generated PID if no PID is provided" do
71
+ it "should create a new Fedora object with a generated PID if no PID is provided" do
72
72
  @mock_api.should_receive(:ingest).with(hash_including(:pid => nil)).and_return('pid')
73
73
  @mock_api.should_receive(:datastreams).with(hash_including(:pid => 'pid')).and_raise(RestClient::ResourceNotFound)
74
74
  subject.save
@@ -93,13 +93,14 @@ describe Rubydora::DigitalObject do
93
93
  end
94
94
 
95
95
  describe "retreive datastreams" do
96
- describe "without profiles (fedora < 3.6)" do
96
+ describe "without profiles (fedora < 3.6)" do
97
97
  before(:each) do
98
98
  @mock_api.stub :datastreams do |hash|
99
99
  "<objectDatastreams><datastream dsid='a'></datastream><datastream dsid='b'></datastream><datastream dsid='c'></datastream></objectDatastreams>"
100
100
  end
101
101
  @object = Rubydora::DigitalObject.new 'pid', @mock_api
102
102
  @object.stub(:new_record? => false)
103
+ @object.stub(:new? => false)
103
104
  end
104
105
 
105
106
  it "should provide a hash populated by the existing datastreams" do
@@ -137,7 +138,7 @@ describe Rubydora::DigitalObject do
137
138
  object.datastreams['asdf'].should be_a_kind_of(MyCustomDatastreamClass)
138
139
  end
139
140
  end
140
- describe "with profiles (fedora >= 3.6)" do
141
+ describe "with profiles (fedora >= 3.6)" do
141
142
  before(:each) do
142
143
  @mock_api.stub :datastreams do |hash|
143
144
  "<objectDatastreams>
@@ -148,6 +149,7 @@ describe Rubydora::DigitalObject do
148
149
  end
149
150
  @object = Rubydora::DigitalObject.new 'pid', @mock_api
150
151
  @object.stub(:new_record? => false)
152
+ @object.stub(:new? => false)
151
153
  end
152
154
 
153
155
  it "should provide a hash populated by the existing datastreams" do
@@ -185,8 +187,9 @@ describe Rubydora::DigitalObject do
185
187
  </datastreamProfile>
186
188
  </objectDatastreams>
187
189
  XML
188
- @object = Rubydora::DigitalObject.new 'pid', @mock_api
190
+ @object = Rubydora::DigitalObject.new 'pid', @mock_api
189
191
  @object.stub(:new_record? => false)
192
+ @object.stub(:new? => false)
190
193
  end
191
194
  describe "datastreams" do
192
195
  it "should provide a hash populated by the existing datastreams" do
@@ -269,7 +272,7 @@ describe Rubydora::DigitalObject do
269
272
  # object date should be canonicalized and updated
270
273
  @object.lastModifiedDate.should == '2012-01-02:05:15:45.1Z'
271
274
  end
272
-
275
+
273
276
  it "should not set lastModifiedDate if the before_save callback is false" do
274
277
  @object.stub(:datastreams) { { :changed_ds => @changed_ds } }
275
278
  @changed_ds.should_receive(:dsCreateDate).and_return(nil)
@@ -451,7 +454,7 @@ describe Rubydora::DigitalObject do
451
454
  Rubydora::Datastream.should_receive(:new).with(anything, 'my_ds', hash_including(:asOfDateTime => '2011-09-26T20:41:02.450Z'))
452
455
  ds = @object.versions.first['my_ds']
453
456
  end
454
-
457
+
455
458
  end
456
459
 
457
460
  describe "to_api_params" do
@@ -479,7 +482,7 @@ describe Rubydora::DigitalObject do
479
482
 
480
483
  it "should fall-back to the set of default attributes" do
481
484
  @mock_api.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
482
- Rubydora::DigitalObject::OBJ_DEFAULT_ATTRIBUTES.should_receive(:[]).with(method.to_sym) { 'zxcv'}
485
+ Rubydora::DigitalObject::OBJ_DEFAULT_ATTRIBUTES.should_receive(:[]).with(method.to_sym) { 'zxcv'}
483
486
  subject.send(method).should == 'zxcv'
484
487
  end
485
488
  end
@@ -499,7 +502,7 @@ describe Rubydora::DigitalObject do
499
502
  subject.send("#{method}=", 'zxcv')
500
503
  end
501
504
 
502
- it "should appear in the save request" do
505
+ it "should appear in the save request" do
503
506
  @mock_api.should_receive(:ingest).with(hash_including(method.to_sym => 'new_value'))
504
507
  @mock_api.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
505
508
  subject.send("#{method}=", 'new_value')
@@ -524,7 +527,7 @@ describe Rubydora::DigitalObject do
524
527
 
525
528
  it "should fall-back to the set of default attributes" do
526
529
  @mock_api.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
527
- Rubydora::DigitalObject::OBJ_DEFAULT_ATTRIBUTES.should_receive(:[]).with(:state) { 'zxcv'}
530
+ Rubydora::DigitalObject::OBJ_DEFAULT_ATTRIBUTES.should_receive(:[]).with(:state) { 'zxcv'}
528
531
  subject.state.should == 'zxcv'
529
532
  end
530
533
  end
@@ -549,7 +552,7 @@ describe Rubydora::DigitalObject do
549
552
  subject.should_not be_changed
550
553
  end
551
554
 
552
- it "should appear in the save request" do
555
+ it "should appear in the save request" do
553
556
  @mock_api.should_receive(:ingest).with(hash_including(:state => 'A'))
554
557
  @mock_api.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
555
558
  subject.state='A'