valkyrie 1.5.0 → 1.5.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: 61b7e04b31c2d342dc23c2a992a3591127100a83
4
- data.tar.gz: e52992172aa6f6a7c0b6f0109d0ddf36d97e1af9
2
+ SHA256:
3
+ metadata.gz: 39e92d9e4892ac5d68a53cbcea67333f51575c4a186f2ffedb97bcc1be846135
4
+ data.tar.gz: c6776eddd61f9e016c92ff23d97061c45d05beb27069d8b814b08b22b6ea6387
5
5
  SHA512:
6
- metadata.gz: 572780616a4d8ac782b405f7bee713590789be2b86c3cba5e004701060713561ebf8d71ee4336a17e39eb52f7b2147dce7229933240748533c352870ba1d931c
7
- data.tar.gz: bfe2c60c9facf6224abc8c411b7bd9d88f832bf80c00f8c4b0a33c4a8c4fdb03faff4152b6ff6b856c72ce0234e88a5ee165f3caa104b03449f99438e0ff0a8a
6
+ metadata.gz: 463a7de54cb62d517e50a0923b2a3532a7bb88dfd6389dcd4223834df136ab6c7353bec60d850f2f22eb28a0ca5b3465b48a6be9d51d06730d62523b5febf8eb
7
+ data.tar.gz: 9682ba62bf4e3071b7c7a2a95a51c540108f80e55b17f39aac9820bfee343531fb20fec2b2573af3ee7db6e99c804ae33e7ec0b76d99963b2618828ed19b5634
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # v1.5.1 2018-02-08
2
+
3
+ ## Changes since last release
4
+
5
+ * Namespace shared-spec resources to avoid conflict in apps.
6
+ [tpendragon](https://github.com/tpendragon)
7
+
8
+ Additional thanks to the following for code review and issue reports leading to
9
+ this release:
10
+
11
+ [cjcolvar](https://github.com/cjcolvar)
12
+ [escowles](https://github.com/escowles)
13
+
1
14
  # v1.5.0 2018-02-06
2
15
 
3
16
  ## Changes since last release
@@ -1,4 +1,9 @@
1
1
  # frozen_string_literal: true
2
+ module Valkyrie
3
+ # Define a wrapper namespace for test resources.
4
+ module Specs
5
+ end
6
+ end
2
7
  require 'valkyrie/specs/shared_specs/persister.rb'
3
8
  require 'valkyrie/specs/shared_specs/queries.rb'
4
9
  require 'valkyrie/specs/shared_specs/metadata_adapter'
@@ -2,25 +2,25 @@
2
2
  RSpec.shared_examples 'a Valkyrie::ChangeSetPersister' do |*_flags|
3
3
  before do
4
4
  raise 'adapter must be set with `let(:change_set_persister)`' unless defined? change_set_persister
5
- class CustomResource < Valkyrie::Resource
5
+ class Valkyrie::Specs::CustomResource < Valkyrie::Resource
6
6
  include Valkyrie::Resource::AccessControls
7
7
  attribute :title
8
8
  attribute :member_ids
9
9
  attribute :nested_resource
10
10
  end
11
- class CustomChangeSet < Valkyrie::ChangeSet
11
+ class Valkyrie::Specs::CustomChangeSet < Valkyrie::ChangeSet
12
12
  self.fields = [:title]
13
13
  end
14
14
  end
15
15
  after do
16
- Object.send(:remove_const, :CustomResource)
17
- Object.send(:remove_const, :CustomChangeSet)
16
+ Valkyrie::Specs.send(:remove_const, :CustomResource)
17
+ Valkyrie::Specs.send(:remove_const, :CustomChangeSet)
18
18
  end
19
19
 
20
20
  subject { change_set_persister }
21
- let(:resource_class) { CustomResource }
21
+ let(:resource_class) { Valkyrie::Specs::CustomResource }
22
22
  let(:resource) { resource_class.new }
23
- let(:change_set) { CustomChangeSet.new(resource) }
23
+ let(:change_set) { Valkyrie::Specs::CustomChangeSet.new(resource) }
24
24
 
25
25
  it { is_expected.to respond_to(:save).with_keywords(:change_set) }
26
26
  it { is_expected.to respond_to(:save_all).with_keywords(:change_sets) }
@@ -32,7 +32,7 @@ RSpec.shared_examples 'a Valkyrie::ChangeSetPersister' do |*_flags|
32
32
  it "saves a resource and returns it" do
33
33
  output = subject.save(change_set: change_set)
34
34
 
35
- expect(output).to be_kind_of CustomResource
35
+ expect(output).to be_kind_of Valkyrie::Specs::CustomResource
36
36
  expect(output).to be_persisted
37
37
  end
38
38
  end
@@ -40,7 +40,7 @@ RSpec.shared_examples 'a Valkyrie::ChangeSetPersister' do |*_flags|
40
40
  describe "#delete" do
41
41
  it "deletes a resource" do
42
42
  output = subject.save(change_set: change_set)
43
- subject.delete(change_set: CustomChangeSet.new(output))
43
+ subject.delete(change_set: Valkyrie::Specs::CustomChangeSet.new(output))
44
44
 
45
45
  expect do
46
46
  subject.metadata_adapter.query_service.find_by(id: output.id)
@@ -50,7 +50,7 @@ RSpec.shared_examples 'a Valkyrie::ChangeSetPersister' do |*_flags|
50
50
 
51
51
  describe "#save_all" do
52
52
  it "saves multiple change_sets and returns them" do
53
- change_set2 = CustomChangeSet.new(resource_class.new)
53
+ change_set2 = Valkyrie::Specs::CustomChangeSet.new(resource_class.new)
54
54
  output = subject.save_all(change_sets: [change_set, change_set2])
55
55
 
56
56
  expect(output.map(&:id).compact.length).to eq 2
@@ -3,21 +3,21 @@ RSpec.shared_examples 'a Valkyrie query provider' do
3
3
  before do
4
4
  raise 'adapter must be set with `let(:adapter)`' unless
5
5
  defined? adapter
6
- class CustomResource < Valkyrie::Resource
6
+ class Valkyrie::Specs::CustomResource < Valkyrie::Resource
7
7
  attribute :alternate_ids, Valkyrie::Types::Set.of(Valkyrie::Types::ID)
8
8
  attribute :title
9
9
  attribute :member_ids, Valkyrie::Types::Array
10
10
  attribute :a_member_of, Valkyrie::Types::Array
11
11
  attribute :an_ordered_member_of, Valkyrie::Types::Array.meta(ordered: true)
12
12
  end
13
- class SecondResource < Valkyrie::Resource
13
+ class Valkyrie::Specs::SecondResource < Valkyrie::Resource
14
14
  end
15
15
  end
16
16
  after do
17
- Object.send(:remove_const, :CustomResource)
18
- Object.send(:remove_const, :SecondResource)
17
+ Valkyrie::Specs.send(:remove_const, :CustomResource)
18
+ Valkyrie::Specs.send(:remove_const, :SecondResource)
19
19
  end
20
- let(:resource_class) { CustomResource }
20
+ let(:resource_class) { Valkyrie::Specs::CustomResource }
21
21
  let(:query_service) { adapter.query_service } unless defined? query_service
22
22
  let(:persister) { adapter.persister }
23
23
  subject { adapter.query_service }
@@ -47,12 +47,12 @@ RSpec.shared_examples 'a Valkyrie query provider' do
47
47
  describe ".find_all_of_model" do
48
48
  it "returns all of that model" do
49
49
  persister.save(resource: resource_class.new)
50
- resource2 = persister.save(resource: SecondResource.new)
50
+ resource2 = persister.save(resource: Valkyrie::Specs::SecondResource.new)
51
51
 
52
- expect(query_service.find_all_of_model(model: SecondResource).map(&:id)).to contain_exactly resource2.id
52
+ expect(query_service.find_all_of_model(model: Valkyrie::Specs::SecondResource).map(&:id)).to contain_exactly resource2.id
53
53
  end
54
54
  it "returns an empty array if there are none" do
55
- expect(query_service.find_all_of_model(model: SecondResource).to_a).to eq []
55
+ expect(query_service.find_all_of_model(model: Valkyrie::Specs::SecondResource).to_a).to eq []
56
56
  end
57
57
  end
58
58
 
@@ -94,7 +94,7 @@ RSpec.shared_examples 'a Valkyrie query provider' do
94
94
  end
95
95
 
96
96
  it 'raises a Valkyrie::Persistence::ObjectNotFoundError when persisted objects do not have alternate_ids' do
97
- persister.save(resource: SecondResource.new)
97
+ persister.save(resource: Valkyrie::Specs::SecondResource.new)
98
98
  expect { query_service.find_by_alternate_identifier(alternate_identifier: Valkyrie::ID.new("123123123")) }.to raise_error ::Valkyrie::Persistence::ObjectNotFoundError
99
99
  end
100
100
 
@@ -193,7 +193,7 @@ RSpec.shared_examples 'a Valkyrie query provider' do
193
193
  end
194
194
 
195
195
  context "when the model doesn't have member_ids" do
196
- let(:parent) { persister.save(resource: SecondResource.new) }
196
+ let(:parent) { persister.save(resource: Valkyrie::Specs::SecondResource.new) }
197
197
 
198
198
  it "returns an empty array" do
199
199
  expect(subject.to_a).to eq []
@@ -202,12 +202,12 @@ RSpec.shared_examples 'a Valkyrie query provider' do
202
202
  end
203
203
 
204
204
  context "filtering by model" do
205
- subject { query_service.find_members(resource: parent, model: SecondResource) }
205
+ subject { query_service.find_members(resource: parent, model: Valkyrie::Specs::SecondResource) }
206
206
 
207
207
  context "when the object has members" do
208
- let(:child1) { persister.save(resource: SecondResource.new) }
208
+ let(:child1) { persister.save(resource: Valkyrie::Specs::SecondResource.new) }
209
209
  let(:child2) { persister.save(resource: resource_class.new) }
210
- let(:child3) { persister.save(resource: SecondResource.new) }
210
+ let(:child3) { persister.save(resource: Valkyrie::Specs::SecondResource.new) }
211
211
  let(:parent) { persister.save(resource: resource_class.new(member_ids: [child3.id, child2.id, child1.id])) }
212
212
 
213
213
  it "returns all a resource's members in order" do
@@ -286,7 +286,7 @@ RSpec.shared_examples 'a Valkyrie query provider' do
286
286
  child = persister.save(resource: resource_class.new(a_member_of: [parent.id]))
287
287
  child2 = persister.save(resource: resource_class.new(a_member_of: [parent.id, parent2.id, parent.id]))
288
288
  persister.save(resource: resource_class.new)
289
- persister.save(resource: SecondResource.new)
289
+ persister.save(resource: Valkyrie::Specs::SecondResource.new)
290
290
 
291
291
  expect(query_service.find_inverse_references_by(resource: parent, property: :a_member_of).map(&:id).to_a).to contain_exactly child.id, child2.id
292
292
  end
@@ -304,7 +304,7 @@ RSpec.shared_examples 'a Valkyrie query provider' do
304
304
  child = persister.save(resource: resource_class.new(an_ordered_member_of: [parent.id]))
305
305
  child2 = persister.save(resource: resource_class.new(an_ordered_member_of: [parent.id, parent.id]))
306
306
  persister.save(resource: resource_class.new)
307
- persister.save(resource: SecondResource.new)
307
+ persister.save(resource: Valkyrie::Specs::SecondResource.new)
308
308
 
309
309
  expect(query_service.find_inverse_references_by(resource: parent, property: :an_ordered_member_of).map(&:id).to_a).to contain_exactly child.id, child2.id
310
310
  end
@@ -318,7 +318,7 @@ RSpec.shared_examples 'a Valkyrie query provider' do
318
318
  child = persister.save(resource: resource_class.new(a_member_of: [parent.id]))
319
319
  child2 = persister.save(resource: resource_class.new(a_member_of: [parent.id, parent2.id, parent.id]))
320
320
  persister.save(resource: resource_class.new)
321
- persister.save(resource: SecondResource.new)
321
+ persister.save(resource: Valkyrie::Specs::SecondResource.new)
322
322
 
323
323
  expect(query_service.find_inverse_references_by(id: parent.id, property: :a_member_of).map(&:id).to_a).to contain_exactly child.id, child2.id
324
324
  end
@@ -364,7 +364,7 @@ RSpec.shared_examples 'a Valkyrie query provider' do
364
364
  end
365
365
 
366
366
  context "when the model doesn't have member_ids" do
367
- let(:child1) { persister.save(resource: SecondResource.new) }
367
+ let(:child1) { persister.save(resource: Valkyrie::Specs::SecondResource.new) }
368
368
 
369
369
  it "returns an empty array if there are none" do
370
370
  expect(query_service.find_parents(resource: child1).to_a).to eq []
@@ -52,16 +52,16 @@ RSpec.shared_examples 'a Valkyrie::Resource' do
52
52
 
53
53
  describe "#human_readable_type" do
54
54
  before do
55
- class MyCustomResource < Valkyrie::Resource
55
+ class Valkyrie::Specs::MyCustomResource < Valkyrie::Resource
56
56
  attribute :title, Valkyrie::Types::Set
57
57
  end
58
58
  end
59
59
 
60
60
  after do
61
- Object.send(:remove_const, :MyCustomResource)
61
+ Valkyrie::Specs.send(:remove_const, :MyCustomResource)
62
62
  end
63
63
 
64
- subject(:my_custom_resource) { MyCustomResource.new }
64
+ subject(:my_custom_resource) { Valkyrie::Specs::MyCustomResource.new }
65
65
 
66
66
  it "returns a human readable rendering of the resource class" do
67
67
  expect(my_custom_resource.human_readable_type).to eq "My Custom Resource"
@@ -11,7 +11,7 @@ RSpec.shared_examples 'a Valkyrie::Persistence::Solr::Indexer' do |*_flags|
11
11
  }
12
12
  end
13
13
  let(:resource) do
14
- Resource.new(
14
+ Valkyrie::Specs::Resource.new(
15
15
  id: "1",
16
16
  internal_resource: 'Resource',
17
17
  attributes: attributes
@@ -20,7 +20,7 @@ RSpec.shared_examples 'a Valkyrie::Persistence::Solr::Indexer' do |*_flags|
20
20
  let(:indexer) { described_class.new(resource: resource) }
21
21
 
22
22
  before do
23
- class Resource < Valkyrie::Resource
23
+ class Valkyrie::Specs::Resource < Valkyrie::Resource
24
24
  attribute :title, Valkyrie::Types::Set
25
25
  attribute :author, Valkyrie::Types::Set
26
26
  attribute :birthday, Valkyrie::Types::DateTime.optional
@@ -29,7 +29,7 @@ RSpec.shared_examples 'a Valkyrie::Persistence::Solr::Indexer' do |*_flags|
29
29
  end
30
30
 
31
31
  after do
32
- Object.send(:remove_const, :Resource)
32
+ Valkyrie::Specs.send(:remove_const, :Resource)
33
33
  end
34
34
 
35
35
  describe '#to_solr' do
@@ -5,11 +5,11 @@ RSpec.shared_examples 'a Valkyrie::StorageAdapter' do
5
5
  defined? storage_adapter
6
6
  raise 'file must be set with `let(:file)`' unless
7
7
  defined? file
8
- class CustomResource < Valkyrie::Resource
8
+ class Valkyrie::Specs::CustomResource < Valkyrie::Resource
9
9
  end
10
10
  end
11
11
  after do
12
- Object.send(:remove_const, :CustomResource)
12
+ Valkyrie::Specs.send(:remove_const, :CustomResource)
13
13
  end
14
14
  subject { storage_adapter }
15
15
  it { is_expected.to respond_to(:handles?).with_keywords(:id) }
@@ -18,7 +18,7 @@ RSpec.shared_examples 'a Valkyrie::StorageAdapter' do
18
18
  it { is_expected.to respond_to(:upload).with_keywords(:file, :resource, :original_filename) }
19
19
 
20
20
  it "can upload, validate, re-fetch, and delete a file" do
21
- resource = CustomResource.new(id: "test")
21
+ resource = Valkyrie::Specs::CustomResource.new(id: "test")
22
22
  sha1 = Digest::SHA1.file(file).to_s
23
23
  size = file.size
24
24
  expect(uploaded_file = storage_adapter.upload(file: file, original_filename: 'foo.jpg', resource: resource)).to be_kind_of Valkyrie::StorageAdapter::File
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Valkyrie
3
- VERSION = "1.5.0"
3
+ VERSION = "1.5.1"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valkyrie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trey Pendragon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-06 00:00:00.000000000 Z
11
+ date: 2019-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -607,7 +607,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
607
607
  version: '0'
608
608
  requirements: []
609
609
  rubyforge_project:
610
- rubygems_version: 2.6.14
610
+ rubygems_version: 2.7.7
611
611
  signing_key:
612
612
  specification_version: 4
613
613
  summary: An ORM using the Data Mapper pattern, specifically built to solve Digital