valkyrie_active_fedora 0.0.4 → 0.0.5

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
2
  SHA256:
3
- metadata.gz: 54848b48285fd7c6f58904ef9fc15f0212d821cd60a4a8ef8bea8ff4fe59f033
4
- data.tar.gz: c9fe09360d043b77bdc4ff1adaca5b5067977fa94506dec478cdc8e07b6412b8
3
+ metadata.gz: 885464a34b9b81470d0c6034123acda3e27a4e5e32ba37f2208b46cef831fa4b
4
+ data.tar.gz: d8b18e50e14aba21712e0723fd7421c0f5a68919ad5af0ec1a5c8f75fba96123
5
5
  SHA512:
6
- metadata.gz: 2a538ce35a5654b121ac922b661c92de1e46a458aad672557742c4a63f4a51d7a08a25eba5a84536c40696a18bd34f061c5259194c47193b2cf5ccc821796b1d
7
- data.tar.gz: 78aaeb00c90dd158b9da980320eb46fa22e4a39dd5b06514c700a7bdb2f2880251c3fe4da71489fc7434b80750c002b7fede92a8ddb6610c1f3397012145bef2
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: 8983, verbose: true, managed: true }
14
- fcrepo_defaults = { port: 8984, verbose: true, managed: true,
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.attributes.symbolize_keys)
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
@@ -1,3 +1,3 @@
1
1
  module ValkyrieActiveFedora
2
- VERSION = '0.0.4'.freeze
2
+ VERSION = '0.0.5'.freeze
3
3
  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
- # has_many :pages
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
- # class Page < ValkyrieActiveFedora::Base
14
- # belongs_to :book_with_pages, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf
15
- # end
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
- # let(:page1) { Page.new(id: 'pg1') }
20
- # let(:page2) { Page.new(id: 'pg2') }
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
- # description: ['a description'],
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
- # description: book.description,
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valkyrie_active_fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - E. Lynette Rayle