rubydora 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,4 +2,9 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'activemodel', "~> 3.1.1"
5
+ gem 'activemodel', ">= 3.1.1"
6
+
7
+ gem 'rcov', :platform => :mri_18
8
+ gem 'simplecov', :platform => :mri_19
9
+ gem 'simplecov-rcov', :platform => :mri_19
10
+ gem 'jruby-openssl', :platform => :jruby
data/History.textile CHANGED
@@ -1,3 +1,6 @@
1
+ h3. 0.5.9
2
+ * Raise exception if it's not 404
3
+
1
4
  h3. 0.5.7
2
5
  * Don't expect that a digital object necessarily has a repository.
3
6
 
data/Rakefile CHANGED
@@ -19,7 +19,11 @@ task :default => :spec
19
19
 
20
20
  desc "Run specs"
21
21
  RSpec::Core::RakeTask.new do |t|
22
- # Put spec opts in a file named .rspec in root
22
+
23
+ if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/
24
+ t.rcov = true
25
+ t.rcov_opts = %w{--exclude spec\/*,gems\/*,ruby\/* --aggregate coverage.data}
26
+ end
23
27
  end
24
28
 
25
29
  require 'yard'
@@ -42,14 +46,28 @@ task :ci do
42
46
  jetty_params = {
43
47
  :jetty_home => File.expand_path(File.dirname(__FILE__) + '/jetty'),
44
48
  :quiet => false,
45
- :jetty_port => 8983,
49
+ :jetty_port => ENV['TEST_JETTY_PORT'] || 8983,
46
50
  :solr_home => File.expand_path(File.dirname(__FILE__) + '/jetty/solr'),
47
51
  :fedora_home => File.expand_path(File.dirname(__FILE__) + '/jetty/fedora/default'),
48
- :startup_wait => 30
52
+ :startup_wait => 30,
53
+ :java_opts => ['-Xmx256m', '-XX:MaxPermSize=128m']
49
54
  }
50
55
 
51
56
  error = Jettywrapper.wrap(jetty_params) do
52
- Rake::Task['spec'].invoke
57
+ Rake::Task['coverage'].invoke
58
+ Rake::Task['yard'].invoke
53
59
  end
54
60
  raise "test failures: #{error}" if error
55
61
  end
62
+
63
+
64
+ desc "Execute specs with coverage"
65
+ task :coverage do
66
+ # Put spec opts in a file named .rspec in root
67
+ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
68
+ ENV['COVERAGE'] = 'true' unless ruby_engine == 'jruby'
69
+
70
+
71
+ Rake::Task['spec'].invoke
72
+ end
73
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.8
1
+ 0.5.9
@@ -134,7 +134,7 @@ module Rubydora
134
134
  @new = false
135
135
 
136
136
  h
137
- rescue Exception => e
137
+ rescue RestClient::ResourceNotFound => e
138
138
  {}
139
139
  end.freeze
140
140
  end
@@ -39,11 +39,16 @@ describe Rubydora::DigitalObject do
39
39
  @mock_repository.should_receive(:object).with(:pid => 'pid').and_return("<objectProfile><a></a></objectProfile>")
40
40
  @object.profile['a'].should be_nil
41
41
  end
42
+
43
+ it "should throw exceptions that arise" do
44
+ @mock_repository.should_receive(:object).with(:pid => 'pid').and_raise(Net::HTTPBadResponse)
45
+ expect { @object.profile }.to raise_error(Net::HTTPBadResponse)
46
+ end
42
47
  end
43
48
 
44
49
  describe "new" do
45
50
  before(:each) do
46
- @mock_repository.stub(:object) { raise "" }
51
+ @mock_repository.stub(:object) { raise RestClient::ResourceNotFound }
47
52
  @object = Rubydora::DigitalObject.new 'pid', @mock_repository
48
53
  end
49
54
 
@@ -373,6 +378,7 @@ describe Rubydora::DigitalObject do
373
378
  end
374
379
 
375
380
  it "should fall-back to the set of default attributes" do
381
+ @mock_repository.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
376
382
  Rubydora::DigitalObject::OBJ_DEFAULT_ATTRIBUTES.should_receive(:[]).with(method.to_sym) { 'zxcv'}
377
383
  subject.send(method).should == 'zxcv'
378
384
  end
@@ -383,6 +389,7 @@ describe Rubydora::DigitalObject do
383
389
  subject.stub(:datastreams => [])
384
390
  end
385
391
  it "should mark the object as changed after setting" do
392
+ @mock_repository.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
386
393
  subject.send("#{method}=", 'new_value')
387
394
  subject.should be_changed
388
395
  end
@@ -394,6 +401,7 @@ describe Rubydora::DigitalObject do
394
401
 
395
402
  it "should appear in the save request" do
396
403
  @mock_repository.should_receive(:ingest).with(hash_including(method.to_sym => 'new_value'))
404
+ @mock_repository.should_receive(:object).with(:pid=>"pid").and_raise(RestClient::ResourceNotFound)
397
405
  subject.send("#{method}=", 'new_value')
398
406
  subject.save
399
407
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  # These tests require a fedora repository with the resource index enabled (and with syncUpdates = true)
5
5
  describe "Integration testing against a live Fedora repository", :integration => true do
6
- REPOSITORY_CONFIG = { :url => 'http://localhost:8983/fedora', :user => 'fedoraAdmin', :password => 'fedoraAdmin' }
6
+ REPOSITORY_CONFIG = { :url => "http://localhost:#{ENV['TEST_JETTY_PORT'] || 8983}/fedora", :user => 'fedoraAdmin', :password => 'fedoraAdmin' }
7
7
  before(:all) do
8
8
  @repository = Rubydora.connect REPOSITORY_CONFIG
9
9
  @repository.find('test:1').delete rescue nil
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,18 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+
4
+
5
+ if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/
6
+ require 'simplecov'
7
+ require 'simplecov-rcov'
8
+
9
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
10
+ SimpleCov.start
11
+ end
12
+
13
+ require 'rspec/autorun'
3
14
  require 'rubydora'
4
- require 'rspec'
15
+
16
+ RSpec.configure do |config|
17
+
18
+ end
metadata CHANGED
@@ -1,231 +1,216 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rubydora
3
- version: !ruby/object:Gem::Version
4
- version: 0.5.8
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 9
10
+ version: 0.5.9
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Chris Beer
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-04-19 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: fastercsv
16
- requirement: !ruby/object:Gem::Requirement
17
+
18
+ date: 2012-05-29 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ requirement: &id001 !ruby/object:Gem::Requirement
17
22
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ version_requirements: *id001
31
+ name: fastercsv
22
32
  type: :runtime
23
33
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
34
+ - !ruby/object:Gem::Dependency
35
+ requirement: &id002 !ruby/object:Gem::Requirement
25
36
  none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ hash: 3
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ version_requirements: *id002
31
45
  name: rest-client
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
46
  type: :runtime
39
47
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
48
+ - !ruby/object:Gem::Dependency
49
+ requirement: &id003 !ruby/object:Gem::Requirement
41
50
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ hash: 3
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ version_requirements: *id003
47
59
  name: nokogiri
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
60
  type: :runtime
55
61
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
62
+ - !ruby/object:Gem::Dependency
63
+ requirement: &id004 !ruby/object:Gem::Requirement
57
64
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ version_requirements: *id004
63
73
  name: mime-types
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
74
  type: :runtime
71
75
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
76
+ - !ruby/object:Gem::Dependency
77
+ requirement: &id005 !ruby/object:Gem::Requirement
73
78
  none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ version_requirements: *id005
79
87
  name: activesupport
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
88
  type: :runtime
87
89
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
90
+ - !ruby/object:Gem::Dependency
91
+ requirement: &id006 !ruby/object:Gem::Requirement
89
92
  none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- - !ruby/object:Gem::Dependency
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ hash: 3
97
+ segments:
98
+ - 0
99
+ version: "0"
100
+ version_requirements: *id006
95
101
  name: activemodel
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
102
  type: :runtime
103
103
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
104
+ - !ruby/object:Gem::Dependency
105
+ requirement: &id007 !ruby/object:Gem::Requirement
105
106
  none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ hash: 3
111
+ segments:
112
+ - 0
113
+ version: "0"
114
+ version_requirements: *id007
111
115
  name: savon
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
116
  type: :runtime
119
117
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
118
+ - !ruby/object:Gem::Dependency
119
+ requirement: &id008 !ruby/object:Gem::Requirement
121
120
  none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- - !ruby/object:Gem::Dependency
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ version_requirements: *id008
127
129
  name: rake
128
- requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
130
  type: :development
135
131
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
132
+ - !ruby/object:Gem::Dependency
133
+ requirement: &id009 !ruby/object:Gem::Requirement
137
134
  none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
- - !ruby/object:Gem::Dependency
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ hash: 3
139
+ segments:
140
+ - 0
141
+ version: "0"
142
+ version_requirements: *id009
143
143
  name: shoulda
144
- requirement: !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
147
- - - ! '>='
148
- - !ruby/object:Gem::Version
149
- version: '0'
150
144
  type: :development
151
145
  prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: '0'
158
- - !ruby/object:Gem::Dependency
159
- name: bundler
160
- requirement: !ruby/object:Gem::Requirement
146
+ - !ruby/object:Gem::Dependency
147
+ requirement: &id010 !ruby/object:Gem::Requirement
161
148
  none: false
162
- requirements:
163
- - - ! '>='
164
- - !ruby/object:Gem::Version
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ hash: 11
153
+ segments:
154
+ - 1
155
+ - 0
156
+ - 14
165
157
  version: 1.0.14
158
+ version_requirements: *id010
159
+ name: bundler
166
160
  type: :development
167
161
  prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
162
+ - !ruby/object:Gem::Dependency
163
+ requirement: &id011 !ruby/object:Gem::Requirement
169
164
  none: false
170
- requirements:
171
- - - ! '>='
172
- - !ruby/object:Gem::Version
173
- version: 1.0.14
174
- - !ruby/object:Gem::Dependency
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ hash: 3
169
+ segments:
170
+ - 0
171
+ version: "0"
172
+ version_requirements: *id011
175
173
  name: rspec
176
- requirement: !ruby/object:Gem::Requirement
177
- none: false
178
- requirements:
179
- - - ! '>='
180
- - !ruby/object:Gem::Version
181
- version: '0'
182
174
  type: :development
183
175
  prerelease: false
184
- version_requirements: !ruby/object:Gem::Requirement
176
+ - !ruby/object:Gem::Dependency
177
+ requirement: &id012 !ruby/object:Gem::Requirement
185
178
  none: false
186
- requirements:
187
- - - ! '>='
188
- - !ruby/object:Gem::Version
189
- version: '0'
190
- - !ruby/object:Gem::Dependency
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ hash: 3
183
+ segments:
184
+ - 0
185
+ version: "0"
186
+ version_requirements: *id012
191
187
  name: yard
192
- requirement: !ruby/object:Gem::Requirement
193
- none: false
194
- requirements:
195
- - - ! '>='
196
- - !ruby/object:Gem::Version
197
- version: '0'
198
188
  type: :development
199
189
  prerelease: false
200
- version_requirements: !ruby/object:Gem::Requirement
190
+ - !ruby/object:Gem::Dependency
191
+ requirement: &id013 !ruby/object:Gem::Requirement
201
192
  none: false
202
- requirements:
203
- - - ! '>='
204
- - !ruby/object:Gem::Version
205
- version: '0'
206
- - !ruby/object:Gem::Dependency
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ hash: 3
197
+ segments:
198
+ - 0
199
+ version: "0"
200
+ version_requirements: *id013
207
201
  name: jettywrapper
208
- requirement: !ruby/object:Gem::Requirement
209
- none: false
210
- requirements:
211
- - - ! '>='
212
- - !ruby/object:Gem::Version
213
- version: '0'
214
202
  type: :development
215
203
  prerelease: false
216
- version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
- requirements:
219
- - - ! '>='
220
- - !ruby/object:Gem::Version
221
- version: '0'
222
- description: ! 'Fedora Commons REST API ruby library : REQUIRES FCREPO 3.4+'
223
- email:
204
+ description: "Fedora Commons REST API ruby library : REQUIRES FCREPO 3.4+"
205
+ email:
224
206
  - chris@cbeer.info
225
207
  executables: []
208
+
226
209
  extensions: []
210
+
227
211
  extra_rdoc_files: []
228
- files:
212
+
213
+ files:
229
214
  - .gitignore
230
215
  - .gitmodules
231
216
  - Gemfile
@@ -266,35 +251,38 @@ files:
266
251
  - spec/spec_helper.rb
267
252
  homepage: http://github.com/cbeer/rubydora
268
253
  licenses: []
254
+
269
255
  post_install_message:
270
256
  rdoc_options: []
271
- require_paths:
257
+
258
+ require_paths:
272
259
  - lib
273
- required_ruby_version: !ruby/object:Gem::Requirement
260
+ required_ruby_version: !ruby/object:Gem::Requirement
274
261
  none: false
275
- requirements:
276
- - - ! '>='
277
- - !ruby/object:Gem::Version
278
- version: '0'
279
- segments:
262
+ requirements:
263
+ - - ">="
264
+ - !ruby/object:Gem::Version
265
+ hash: 3
266
+ segments:
280
267
  - 0
281
- hash: -1624989278098246824
282
- required_rubygems_version: !ruby/object:Gem::Requirement
268
+ version: "0"
269
+ required_rubygems_version: !ruby/object:Gem::Requirement
283
270
  none: false
284
- requirements:
285
- - - ! '>='
286
- - !ruby/object:Gem::Version
287
- version: '0'
288
- segments:
271
+ requirements:
272
+ - - ">="
273
+ - !ruby/object:Gem::Version
274
+ hash: 3
275
+ segments:
289
276
  - 0
290
- hash: -1624989278098246824
277
+ version: "0"
291
278
  requirements: []
279
+
292
280
  rubyforge_project:
293
- rubygems_version: 1.8.21
281
+ rubygems_version: 1.8.17
294
282
  signing_key:
295
283
  specification_version: 3
296
284
  summary: Fedora Commons REST API ruby library
297
- test_files:
285
+ test_files:
298
286
  - spec/lib/datastream_spec.rb
299
287
  - spec/lib/digital_object_spec.rb
300
288
  - spec/lib/ext_model_loader_spec.rb