active-fedora 11.1.5 → 11.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b127c21e13c24e017a536d3babf9e442bd1ae4eb
4
- data.tar.gz: c75ce470aac8faf4a8b729f624f0ee8062997610
3
+ metadata.gz: a4288e97d72b9829adfa9892a3013ddc587624bc
4
+ data.tar.gz: 78a3834e826d71206fae523c8c70c48538bc3f0c
5
5
  SHA512:
6
- metadata.gz: ae7951d53fb1f44bdd749e953c12e53c3984f9161fe8988ae6c92bd3ccc8ef0505fb2c27764f46c88a880d5ed5af7e9019aa4d52e1d68747ac36db58fc05640d
7
- data.tar.gz: 5a664cea927d252abe59a7993b9ba3ea63ad5e89e360cfea72f1281722c965062a9a08ab8340b3d0fd301278c053a6f6b57b17ac1028de9f24e093f5dec8a75e
6
+ metadata.gz: 2b0fbfc067535245ae40b410fcc8641b4a042c84c2d07ae248225cb2998ed2dc4728d2dcfef81f8cb5540771c2afd7578bdb5c8584e9e438ee4725bb9289c610
7
+ data.tar.gz: 3111010745fb585c75009fd10e7d221e6339c588fa907374966186641135d5f21114b10680cccd0844a7de1b89f57ca3da35ef0ed605a8bb81e924afbe6f42b1
@@ -106,7 +106,6 @@ Style/AndOr:
106
106
  Style/AccessorMethodName:
107
107
  Exclude:
108
108
  - 'lib/active_fedora/with_metadata/metadata_node.rb'
109
- - 'lib/active_fedora/predicates.rb'
110
109
  - 'lib/active_fedora/fedora_attributes.rb'
111
110
  - 'lib/active_fedora/attribute_methods/dirty.rb'
112
111
  - 'lib/active_fedora/associations/has_many_association.rb'
@@ -207,7 +206,6 @@ Style/ClassVars:
207
206
  - 'spec/unit/finder_methods_spec.rb'
208
207
  - 'spec/unit/base_spec.rb'
209
208
  - 'spec/integration/indexing_spec.rb'
210
- - 'lib/active_fedora/predicates.rb'
211
209
  - 'lib/active_fedora/identifiable.rb'
212
210
 
213
211
  Style/SignalException:
data/README.md CHANGED
@@ -81,7 +81,7 @@ solr_wrapper
81
81
  To start FCRepo, open another shell and run:
82
82
 
83
83
  ```bash
84
- fcrepo_wrapper -p 8984
84
+ fcrepo_wrapper -p 8986
85
85
  ```
86
86
 
87
87
  Now you’re ready to run the tests. In the directory where active\_fedora
@@ -80,7 +80,7 @@ module ActiveFedora
80
80
  # Set node subjects to a term in AF JUST so that AF will persist the
81
81
  # sub-graphs.
82
82
  # TODO: Find a way to fix this.
83
- self.nodes = nil
83
+ resource.set_value(:nodes, [])
84
84
  self.nodes += graph.subjects.to_a
85
85
  ordered_self.changes_committed!
86
86
  end
@@ -16,7 +16,7 @@ module ActiveFedora::Attributes
16
16
  mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
17
17
  def #{name}=(value)
18
18
  if value.present? && !value.respond_to?(:each)
19
- raise ArgumentError, "You attempted to set the property `#{name}' to a scalar value. However, this property is declared as being multivalued."
19
+ raise ArgumentError, "You attempted to set the property `#{name}' of \#{id} to a scalar value. However, this property is declared as being multivalued."
20
20
  end
21
21
  set_value(:#{name}, value)
22
22
  end
@@ -28,7 +28,7 @@ module ActiveFedora::Attributes
28
28
  def #{name}(*args)
29
29
  vals = get_values(:#{name})
30
30
  return nil unless vals
31
- raise ActiveFedora::ConstraintError, "Expected \\"#{name}\\" to have 0-1 statements, but there are \#{vals.size}" if vals.size > 1
31
+ raise ActiveFedora::ConstraintError, "Expected \\"#{name}\\" of \#{id} to have 0-1 statements, but there are \#{vals.size}" if vals.size > 1
32
32
  vals.first
33
33
  end
34
34
  CODE
@@ -46,7 +46,7 @@ module ActiveFedora::Attributes
46
46
  mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
47
47
  def #{name}=(value)
48
48
  if value.respond_to?(:each) # singular
49
- raise ArgumentError, "You attempted to set the property `#{name}' to an enumerable value. However, this property is declared as singular."
49
+ raise ArgumentError, "You attempted to set the property `#{name}' of \#{id} to an enumerable value. However, this property is declared as singular."
50
50
  end
51
51
  set_value(:#{name}, value)
52
52
  end
@@ -12,7 +12,7 @@ module ActiveFedora
12
12
  # If B < A and C < B and if A is an abstract_class then both B.base_class
13
13
  # and C.base_class would return B as the answer since A is an abstract_class.
14
14
  def base_class
15
- return File if self == File || superclass == File
15
+ return File if self <= File
16
16
 
17
17
  unless self <= Base
18
18
  raise ActiveFedoraError, "#{name} doesn't belong in a hierarchy descending from ActiveFedora"
@@ -12,7 +12,7 @@ def with_server(environment)
12
12
  # setting port: nil assigns a random port.
13
13
  solr_defaults = { port: nil, verbose: true, managed: true }
14
14
  fcrepo_defaults = { port: nil, verbose: true, managed: true,
15
- enable_jms: false, fcrepo_home_dir: "fcrepo4-#{environment}-data" }
15
+ enable_jms: false, fcrepo_home_dir: "tmp/fcrepo4-#{environment}-data" }
16
16
 
17
17
  SolrWrapper.wrap(load_config(:solr, environment, solr_defaults)) do |solr|
18
18
  ENV["SOLR_#{environment.upcase}_PORT"] = solr.port.to_s
@@ -189,7 +189,8 @@ module ActiveFedora
189
189
  protected
190
190
 
191
191
  def load_from_fedora(id, cast)
192
- raise ActiveFedora::ObjectNotFoundError if id.empty?
192
+ raise ActiveFedora::ObjectNotFoundError, "No ID provided for #{klass.name}." if id.empty?
193
+
193
194
  resource = ActiveFedora.fedora.ldp_resource_service.build(klass, id)
194
195
  raise_record_not_found_exception!(id) if resource.new?
195
196
  class_to_load(resource, cast).allocate.init_with_resource(resource) # Triggers the find callback
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "11.1.5".freeze
2
+ VERSION = "11.1.6".freeze
3
3
  end
@@ -16,7 +16,7 @@ describe ActiveFedora::Base do
16
16
  end
17
17
 
18
18
  subject(:history) { obj }
19
- let(:obj) { BarHistory4.new(title: ['test1']) }
19
+ let(:obj) { BarHistory4.new(title: ['test1'], id: 'test:123') }
20
20
 
21
21
  describe "#attribute_names" do
22
22
  context "on an instance" do
@@ -34,15 +34,7 @@ describe ActiveFedora::Base do
34
34
 
35
35
  describe "#inspect" do
36
36
  it "shows the attributes" do
37
- expect(history.inspect).to eq "#<BarHistory4 id: nil, title: [\"test1\"], abstract: nil>"
38
- end
39
-
40
- describe "with a id" do
41
- before { allow(history).to receive(:id).and_return('test:123') }
42
-
43
- it "shows a id" do
44
- expect(history.inspect).to eq "#<BarHistory4 id: \"test:123\", title: [\"test1\"], abstract: nil>"
45
- end
37
+ expect(history.inspect).to eq "#<BarHistory4 id: \"test:123\", title: [\"test1\"], abstract: nil>"
46
38
  end
47
39
 
48
40
  describe "with no attributes" do
@@ -98,7 +90,7 @@ describe ActiveFedora::Base do
98
90
  history.resource[:abstract] = ['foo', 'bar']
99
91
  end
100
92
  it "raises an error if just returning the first value would cause data loss" do
101
- expect { history[:abstract] }.to raise_error ActiveFedora::ConstraintError, "Expected \"abstract\" to have 0-1 statements, but there are 2"
93
+ expect { history[:abstract] }.to raise_error ActiveFedora::ConstraintError, "Expected \"abstract\" of test:123 to have 0-1 statements, but there are 2"
102
94
  end
103
95
  end
104
96
  end
@@ -144,7 +136,7 @@ describe ActiveFedora::Base do
144
136
  it "does not allow an enumerable to a unique attribute writer" do
145
137
  expect { history.abstract = "Low" }.not_to raise_error
146
138
  expect { history.abstract = ["Low"]
147
- }.to raise_error ArgumentError, "You attempted to set the property `abstract' to an enumerable value. However, this property is declared as singular."
139
+ }.to raise_error ArgumentError, "You attempted to set the property `abstract' of test:123 to an enumerable value. However, this property is declared as singular."
148
140
  expect { history.abstract = nil }.not_to raise_error
149
141
  end
150
142
  end
@@ -8,6 +8,9 @@ describe ActiveFedora::Base do
8
8
  class MySample < ActiveFedora::File
9
9
  end
10
10
 
11
+ class MyDeepSample < MySample
12
+ end
13
+
11
14
  class Foo < ActiveFedora::Base
12
15
  has_subresource 'foostream', class_name: 'MyDS'
13
16
  has_subresource 'dcstream', class_name: 'MySample'
@@ -16,6 +19,9 @@ describe ActiveFedora::Base do
16
19
  class Bar < ActiveFedora::Base
17
20
  has_subresource 'barstream', class_name: 'MyDS'
18
21
  end
22
+
23
+ class Baz < Bar
24
+ end
19
25
  end
20
26
 
21
27
  subject(:attached_files) { f.attached_files }
@@ -25,10 +31,30 @@ describe ActiveFedora::Base do
25
31
  expect(attached_files.values).to match_array [MyDS, MySample]
26
32
  end
27
33
 
34
+ context 'base_class' do
35
+ it 'shallow < Base' do
36
+ expect(Bar.base_class).to eq(Bar)
37
+ end
38
+
39
+ it 'deep < Base' do
40
+ expect(Baz.base_class).to eq(Bar)
41
+ end
42
+
43
+ it 'shallow < File' do
44
+ expect(MySample.base_class).to eq(ActiveFedora::File)
45
+ end
46
+
47
+ it 'deep < File' do
48
+ expect(MyDeepSample.base_class).to eq(ActiveFedora::File)
49
+ end
50
+ end
51
+
28
52
  after do
53
+ Object.send(:remove_const, :Baz)
29
54
  Object.send(:remove_const, :Bar)
30
55
  Object.send(:remove_const, :Foo)
31
56
  Object.send(:remove_const, :MyDS)
57
+ Object.send(:remove_const, :MyDeepSample)
32
58
  Object.send(:remove_const, :MySample)
33
59
  end
34
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.1.5
4
+ version: 11.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-03-07 00:00:00.000000000 Z
13
+ date: 2017-04-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr
@@ -684,7 +684,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
684
684
  version: '0'
685
685
  requirements: []
686
686
  rubyforge_project:
687
- rubygems_version: 2.6.10
687
+ rubygems_version: 2.4.5.1
688
688
  signing_key:
689
689
  specification_version: 4
690
690
  summary: A convenience libary for manipulating documents in the Fedora Repository.