valkyrie_active_fedora 0.0.4 → 0.0.5
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 885464a34b9b81470d0c6034123acda3e27a4e5e32ba37f2208b46cef831fa4b
|
4
|
+
data.tar.gz: d8b18e50e14aba21712e0723fd7421c0f5a68919ad5af0ec1a5c8f75fba96123
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 876b6f2e261d12c5168f215050f7db0b4f56ec602b42ff850acd1a229b4ea0a1a955c9df5145560fa9c026812b7c3f1cea8a1be03c911a863edbeaa7056560c5
|
7
|
+
data.tar.gz: 2894ecd314aad31b25bf63f82ec71ea7f972c3173c702a50ec8ef1d53aa9e8e012e1666061f8c484d58e0ccbd410677573105a759beb45e2e59581efa66d26aa
|
data/.rubocop_todo.yml
CHANGED
@@ -18,3 +18,13 @@ Style/PercentLiteralDelimiters:
|
|
18
18
|
# URISchemes: http, https
|
19
19
|
Metrics/LineLength:
|
20
20
|
Max: 82
|
21
|
+
|
22
|
+
RSpec/ExampleLength:
|
23
|
+
Max: 9
|
24
|
+
Exclude:
|
25
|
+
- 'spec/**_spec.rb'
|
26
|
+
|
27
|
+
## DO NOT MERGE THIS UNCOMMENTED! To allow byebug when debugging, uncomment the following.
|
28
|
+
#Lint/Debugger:
|
29
|
+
# Exclude:
|
30
|
+
# - '**/*'
|
@@ -10,8 +10,8 @@ def with_server(environment)
|
|
10
10
|
ENV["#{environment}_SERVER_STARTED"] = 'true'
|
11
11
|
|
12
12
|
# setting port: nil assigns a random port.
|
13
|
-
solr_defaults = { port:
|
14
|
-
fcrepo_defaults = { port:
|
13
|
+
solr_defaults = { port: nil, verbose: true, managed: true }
|
14
|
+
fcrepo_defaults = { port: nil, verbose: true, managed: true,
|
15
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|
|
@@ -39,23 +39,14 @@ module ValkyrieActiveFedora
|
|
39
39
|
active_fedora_local.send(:properties).each_key do |property_name|
|
40
40
|
attribute property_name.to_sym, ::Valkyrie::Types::String
|
41
41
|
end
|
42
|
+
active_fedora_local.linked_id_keys.each do |linked_property_name|
|
43
|
+
attribute linked_property_name.to_sym, ::Valkyrie::Types::Set.of(::Valkyrie::Types::ID)
|
44
|
+
end
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
45
|
-
klass.new(id: active_fedora_object.id, **active_fedora_object.
|
48
|
+
klass.new(id: active_fedora_object.id, **active_fedora_object.attributes_including_linked_ids.symbolize_keys)
|
46
49
|
end
|
47
|
-
|
48
|
-
# private
|
49
|
-
#
|
50
|
-
# def attributes_including_linked_ids
|
51
|
-
# local_attributes = attributes.dup
|
52
|
-
# reflections.keys.each do |key|
|
53
|
-
# id_method = "#{key.to_s.singularize}_ids"
|
54
|
-
# next unless self.respond_to? id_method
|
55
|
-
# local_attributes.merge!(id_method => self.send(id_method)).with_indifferent_access
|
56
|
-
# end
|
57
|
-
# local_attributes
|
58
|
-
# end
|
59
50
|
end
|
60
51
|
# rubocop:enable Style/ClassVars
|
61
52
|
end
|
@@ -5,27 +5,26 @@ RSpec.describe ValkyrieActiveFedora::ResourceFactory do
|
|
5
5
|
subject(:factory) { described_class.new(active_fedora_object: book) }
|
6
6
|
|
7
7
|
class BookWithPages < ValkyrieActiveFedora::Base
|
8
|
-
|
8
|
+
has_many :pages
|
9
9
|
property :title, predicate: ::RDF::Vocab::DC.title
|
10
10
|
property :contributor, predicate: ::RDF::Vocab::DC.contributor
|
11
11
|
property :description, predicate: ::RDF::Vocab::DC.description
|
12
12
|
end
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
class Page < ValkyrieActiveFedora::Base
|
14
|
+
belongs_to :book_with_pages, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf
|
15
|
+
end
|
16
16
|
|
17
17
|
let(:id) { 'moomin123' }
|
18
18
|
let(:book) { BookWithPages.new(id: id, **attributes) }
|
19
|
-
|
20
|
-
|
19
|
+
let(:page1) { Page.new(id: 'pg1') }
|
20
|
+
let(:page2) { Page.new(id: 'pg2') }
|
21
21
|
|
22
22
|
let(:attributes) do
|
23
23
|
{
|
24
|
-
title: ['fake title'],
|
24
|
+
title: ['fake title', 'fake title 2'],
|
25
25
|
contributor: ['user1'],
|
26
|
-
description: ['a description']
|
27
|
-
|
28
|
-
# pages: [page1, page2]
|
26
|
+
description: ['a description'],
|
27
|
+
pages: [page1, page2]
|
29
28
|
}
|
30
29
|
end
|
31
30
|
|
@@ -57,8 +56,11 @@ RSpec.describe ValkyrieActiveFedora::ResourceFactory do
|
|
57
56
|
.to have_attributes title: book.title,
|
58
57
|
contributor: book.contributor,
|
59
58
|
description: book.description
|
60
|
-
|
61
|
-
# page_ids: [page1.id, page2.id]
|
59
|
+
expect_ids_to_match(factory.build.page_ids, ['pg1', 'pg2'])
|
62
60
|
end
|
63
61
|
end
|
62
|
+
|
63
|
+
def expect_ids_to_match(valkyrie_ids, expected_ids)
|
64
|
+
expect(valkyrie_ids.map(&:id)).to match_array expected_ids
|
65
|
+
end
|
64
66
|
end
|