active-fedora 12.0.0 → 12.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bedac14828094879a2772f8ab082a5ff0af2ac44
4
- data.tar.gz: efd5b61d006fd8a7f2c99105d7cd11bf00b7c5b8
2
+ SHA256:
3
+ metadata.gz: e4477e94db6cb4a9e1f22323c2dc319e8c32b029b66f973bc4b6b65bdfe289d9
4
+ data.tar.gz: 4a68c80e4e06bf4b820e5d64066894a16cc36b4e31121eef4fe890fb93b321a9
5
5
  SHA512:
6
- metadata.gz: e56690ae20fd41c22ef507fc89a8c2350ac956cded3bd72d7d46ff43e181ccfe9224e3e40535ab5716b64a34efea98d87bbd7d364fa14c5b9f879cacf65be99f
7
- data.tar.gz: 18ccc767a70af04dff33580ef2785483adbc3f0e51d8ae382ab65cf49db741b9cca8042c1cf7c59613aa6bcdbe4a0f91839a9a55b6d786c3b08dc74c2bd7f67c
6
+ metadata.gz: da15216891813bfc736c43db883c5398a2e80a268c019935c64df29e77242235f64313776b5de454a18b8626d2b5dbed28c193793d4dd0048638cba377faf32f
7
+ data.tar.gz: 4b249fcc89efcb630f066ddf8b4705dfa7fab9326ca8d95225d75fc43eb710a14a00572d947bdfa1a5c2f51cfc90778e79aa10fee128e910bbaa91510e287ada
@@ -194,13 +194,17 @@ module ActiveFedora
194
194
  ActiveFedora::Base
195
195
  else
196
196
  resource_class = ActiveFedora.model_mapper.classifier(resource).best_model
197
- unless resource_class <= @klass
197
+ unless equivalent_class?(resource_class)
198
198
  raise ActiveFedora::ModelMismatch, "Expected #{@klass}. Got: #{resource_class}"
199
199
  end
200
200
  resource_class
201
201
  end
202
202
  end
203
203
 
204
+ def equivalent_class?(other_class)
205
+ other_class <= @klass
206
+ end
207
+
204
208
  def find_with_ids(ids, cast)
205
209
  expects_array = ids.first.is_a?(Array)
206
210
  return ids.first if expects_array && ids.first.empty?
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "12.0.0".freeze
2
+ VERSION = "12.0.1".freeze
3
3
  end
@@ -9,7 +9,7 @@ module ActiveFedora
9
9
  end
10
10
 
11
11
  def fcrepo_wrapper_config
12
- copy_file '.fcrepo_wrapper', '.fcrepo_wrapper'
12
+ copy_file '.fcrepo_wrapper.yml'
13
13
  copy_file 'fcrepo_wrapper_test.yml', 'config/fcrepo_wrapper_test.yml'
14
14
  end
15
15
  end
@@ -11,7 +11,8 @@ module ActiveFedora
11
11
  end
12
12
 
13
13
  def solr_wrapper_config
14
- copy_file '.solr_wrapper', '.solr_wrapper'
14
+ # Overwrite the configuration files that Blacklight has installed
15
+ copy_file '.solr_wrapper.yml', force: true
15
16
  copy_file 'solr_wrapper_test.yml', 'config/solr_wrapper_test.yml'
16
17
  end
17
18
  end
@@ -6,7 +6,7 @@ describe ActiveFedora::Config::FedoraGenerator do
6
6
  let(:generator) { described_class.new }
7
7
  let(:files_to_test) { [
8
8
  'config/fcrepo_wrapper_test.yml',
9
- '.fcrepo_wrapper'
9
+ '.fcrepo_wrapper.yml'
10
10
  ]}
11
11
 
12
12
  before do
@@ -6,7 +6,7 @@ describe ActiveFedora::Config::SolrGenerator do
6
6
  let(:generator) { described_class.new }
7
7
  let(:files_to_test) { [
8
8
  'config/solr_wrapper_test.yml',
9
- '.solr_wrapper'
9
+ '.solr_wrapper.yml'
10
10
  ]}
11
11
 
12
12
  it "creates config files" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ActiveFedora::FinderMethods do
3
+ RSpec.describe ActiveFedora::FinderMethods do
4
4
  let(:object_class) do
5
5
  Class.new do
6
6
  def self.delegated_attributes
@@ -30,6 +30,52 @@ describe ActiveFedora::FinderMethods do
30
30
 
31
31
  let(:finder) { finder_class.new }
32
32
 
33
+ describe '#equivalent_class?' do
34
+ let(:child_class) { Class.new(object_class) }
35
+ let(:object_class) { Class.new }
36
+ it 'is true for the exact class' do
37
+ expect(finder.send(:equivalent_class?, object_class)).to be true
38
+ end
39
+
40
+ it 'is true for child classes' do
41
+ expect(finder.send(:equivalent_class?, child_class)).to be true
42
+ end
43
+
44
+ it 'is falsey for non-decendants' do
45
+ expect(finder.send(:equivalent_class?, Class.new)).to be_nil
46
+ end
47
+ end
48
+
49
+ describe '#class_to_load' do
50
+ subject(:class_to_load) { finder.send(:class_to_load, resource, true) }
51
+
52
+ let(:best_model) { Class.new }
53
+ let(:mapper) { instance_double(ActiveFedora::DefaultModelMapper, classifier: classifier) }
54
+ let(:classifier) { instance_double(ActiveFedora::ModelClassifier, best_model: best_model) }
55
+ let(:resource) { instance_double(Hash) }
56
+
57
+ before do
58
+ allow(ActiveFedora).to receive(:model_mapper).and_return(mapper)
59
+ end
60
+
61
+ context 'when using the default implementation' do
62
+ it 'raises an error' do
63
+ expect { class_to_load }.to raise_error ActiveFedora::ModelMismatch
64
+ end
65
+ end
66
+
67
+ context 'when a custom finder overrides equivalent_class?' do
68
+ before do
69
+ allow(finder).to receive(:equivalent_class?).and_return(true)
70
+ end
71
+
72
+ it 'calls the overridden implementation' do
73
+ expect(class_to_load).to eq best_model
74
+ expect(finder).to have_received(:equivalent_class?).with(best_model)
75
+ end
76
+ end
77
+ end
78
+
33
79
  describe "#condition_to_clauses" do
34
80
  subject { finder.send(:condition_to_clauses, key, value) }
35
81
  let(:key) { 'library_id' }
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: 12.0.0
4
+ version: 12.0.1
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-11-07 00:00:00.000000000 Z
13
+ date: 2018-01-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr
@@ -559,11 +559,11 @@ files:
559
559
  - lib/generators/active_fedora/config/USAGE
560
560
  - lib/generators/active_fedora/config/config_generator.rb
561
561
  - lib/generators/active_fedora/config/fedora/fedora_generator.rb
562
- - lib/generators/active_fedora/config/fedora/templates/.fcrepo_wrapper
562
+ - lib/generators/active_fedora/config/fedora/templates/.fcrepo_wrapper.yml
563
563
  - lib/generators/active_fedora/config/fedora/templates/fcrepo_wrapper_test.yml
564
564
  - lib/generators/active_fedora/config/fedora/templates/fedora.yml
565
565
  - lib/generators/active_fedora/config/solr/solr_generator.rb
566
- - lib/generators/active_fedora/config/solr/templates/.solr_wrapper
566
+ - lib/generators/active_fedora/config/solr/templates/.solr_wrapper.yml
567
567
  - lib/generators/active_fedora/config/solr/templates/solr.yml
568
568
  - lib/generators/active_fedora/config/solr/templates/solr/config/_rest_managed.json
569
569
  - lib/generators/active_fedora/config/solr/templates/solr/config/admin-extra.html
@@ -744,7 +744,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
744
744
  version: '0'
745
745
  requirements: []
746
746
  rubyforge_project:
747
- rubygems_version: 2.6.13
747
+ rubygems_version: 2.7.1
748
748
  signing_key:
749
749
  specification_version: 4
750
750
  summary: A convenience libary for manipulating documents in the Fedora Repository.