hyrax 2.4.1 → 2.5.0
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 +5 -5
- data/.circleci/config.yml +139 -69
- data/.travis.yml +4 -1
- data/README.md +2 -2
- data/app/actors/hyrax/actors/transactional_request.rb +8 -8
- data/app/services/hyrax/default_middleware_stack.rb +4 -2
- data/app/views/catalog/_thumbnail_list_collection.html.erb +3 -2
- data/hyrax.gemspec +3 -6
- data/lib/hyrax/version.rb +1 -1
- data/spec/abilities/collection_ability_spec.rb +5 -5
- data/spec/abilities/permission_template_ability_spec.rb +1 -1
- data/spec/actors/hyrax/actors/collections_membership_actor_spec.rb +5 -5
- data/spec/actors/hyrax/actors/transactional_request_spec.rb +4 -2
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/collection_types_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +9 -9
- data/spec/controllers/hyrax/collections_controller_spec.rb +5 -5
- data/spec/controllers/hyrax/dashboard/collection_members_controller_spec.rb +16 -13
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +8 -8
- data/spec/controllers/hyrax/dashboard/nest_collections_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/my/shares_controller_spec.rb +1 -1
- data/spec/features/actor_stack_spec.rb +48 -0
- data/spec/features/catalog_search_spec.rb +2 -2
- data/spec/features/collection_multi_membership_spec.rb +2 -2
- data/spec/features/collection_spec.rb +7 -7
- data/spec/features/collection_type_spec.rb +2 -2
- data/spec/features/dashboard/collection_spec.rb +15 -15
- data/spec/features/search_spec.rb +2 -2
- data/spec/features/work_show_spec.rb +5 -2
- data/spec/forms/hyrax/forms/collection_form_spec.rb +5 -5
- data/spec/forms/hyrax/forms/permission_template_form_spec.rb +1 -1
- data/spec/indexers/hyrax/collection_indexer_spec.rb +1 -1
- data/spec/jobs/characterize_job_spec.rb +1 -1
- data/spec/lib/hyrax/resource_sync/change_list_writer_spec.rb +35 -21
- data/spec/lib/hyrax/resource_sync/resource_list_writer_spec.rb +1 -1
- data/spec/models/collection_spec.rb +18 -18
- data/spec/models/concerns/hyrax/collection_nesting_spec.rb +2 -2
- data/spec/models/hyrax/collection_type_spec.rb +2 -2
- data/spec/presenters/hyrax/collection_presenter_spec.rb +11 -11
- data/spec/search_builders/hyrax/collection_member_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/collection_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/dashboard/nested_collections_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/work_relation_spec.rb +1 -1
- data/spec/services/hyrax/adapters/nesting_index_adapter_spec.rb +2 -2
- data/spec/services/hyrax/collections/collection_member_service_spec.rb +2 -2
- data/spec/services/hyrax/collections/migration_service_spec.rb +27 -27
- data/spec/services/hyrax/collections/nested_collection_persistence_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/nested_collection_query_service_spec.rb +38 -38
- data/spec/services/hyrax/statistics/depositors/summary_spec.rb +1 -1
- data/spec/services/hyrax/statistics/works/by_resource_type_spec.rb +11 -4
- data/spec/spec_helper.rb +10 -8
- data/spec/support/selectors.rb +10 -1
- data/spec/views/catalog/_thumbnail_list_collection.html.erb_spec.rb +38 -5
- data/template.rb +3 -1
- metadata +23 -21
@@ -9,7 +9,7 @@ RSpec.describe 'searching' do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
let!(:collection) do
|
12
|
-
create(:
|
12
|
+
create(:public_collection_lw, title: ['collection title abc'], description: [subject_value], user: user, members: [work])
|
13
13
|
end
|
14
14
|
|
15
15
|
context "as a public user", :clean_repo do
|
@@ -53,7 +53,7 @@ RSpec.describe 'searching' do
|
|
53
53
|
expect(page).to have_content('Search Results')
|
54
54
|
expect(page).to have_content "Toothbrush"
|
55
55
|
expect(page).to have_content('collection title abc')
|
56
|
-
expect(page).to
|
56
|
+
expect(page).to have_selector("//img")
|
57
57
|
|
58
58
|
expect(page.body).to include "<span itemprop=\"keywords\"><a href=\"/catalog?f%5Bkeyword_sim%5D%5B%5D=taco&locale=en\">taco</a></span>"
|
59
59
|
expect(page.body).to include "<span itemprop=\"keywords\"><a href=\"/catalog?f%5Bkeyword_sim%5D%5B%5D=mustache&locale=en\">mustache</a></span>"
|
@@ -53,11 +53,14 @@ RSpec.describe "work show view" do
|
|
53
53
|
it "allows adding work to a collection", clean_repo: true, js: true do
|
54
54
|
optional 'ability to get capybara to find css select2-result (see Issue #3038)' if ci_build?
|
55
55
|
click_button "Add to collection" # opens the modal
|
56
|
-
|
56
|
+
# Really ensure that this Collection model is persisted
|
57
|
+
Collection.all.map(&:destroy!)
|
58
|
+
persisted_collection = create(:collection_lw, user: user, collection_type_gid: multi_membership_type_1.gid)
|
59
|
+
select_member_of_collection(persisted_collection)
|
57
60
|
click_button 'Save changes'
|
58
61
|
|
59
62
|
# forwards to collection show page
|
60
|
-
expect(page).to have_content
|
63
|
+
expect(page).to have_content persisted_collection.title.first
|
61
64
|
expect(page).to have_content work.title.first
|
62
65
|
expect(page).to have_selector '.alert-success', text: 'Collection was successfully updated.'
|
63
66
|
end
|
@@ -24,7 +24,7 @@ RSpec.describe Hyrax::Forms::CollectionForm do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
let(:collection) { build(:
|
27
|
+
let(:collection) { build(:collection_lw) }
|
28
28
|
let(:ability) { Ability.new(create(:user)) }
|
29
29
|
let(:repository) { double }
|
30
30
|
let(:form) { described_class.new(collection, ability, repository) }
|
@@ -74,8 +74,8 @@ RSpec.describe Hyrax::Forms::CollectionForm do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
context "nested relationships" do
|
77
|
-
let(:child_collection) { build(:
|
78
|
-
let(:parent_collection) { build(:
|
77
|
+
let(:child_collection) { build(:collection_lw) }
|
78
|
+
let(:parent_collection) { build(:collection_lw) }
|
79
79
|
let(:service_object) { double(available_member_subcollections: double(documents: [child_collection])) }
|
80
80
|
|
81
81
|
before do
|
@@ -174,7 +174,7 @@ RSpec.describe Hyrax::Forms::CollectionForm do
|
|
174
174
|
subject { form.permission_template }
|
175
175
|
|
176
176
|
context "when the PermissionTemplate doesn't exist" do
|
177
|
-
let(:model) {
|
177
|
+
let(:model) { build(:collection_lw) }
|
178
178
|
|
179
179
|
it "gets created" do
|
180
180
|
expect(subject).to be_instance_of Hyrax::Forms::PermissionTemplateForm
|
@@ -185,7 +185,7 @@ RSpec.describe Hyrax::Forms::CollectionForm do
|
|
185
185
|
context "when the PermissionTemplate exists" do
|
186
186
|
let(:form) { described_class.new(model, ability, repository) }
|
187
187
|
let(:permission_template) { Hyrax::PermissionTemplate.find_by(source_id: model.id) }
|
188
|
-
let(:model) {
|
188
|
+
let(:model) { build(:collection_lw, with_permission_template: true) }
|
189
189
|
|
190
190
|
it "uses the existing template" do
|
191
191
|
expect(subject).to be_instance_of Hyrax::Forms::PermissionTemplateForm
|
@@ -3,7 +3,7 @@ RSpec.describe Hyrax::Forms::PermissionTemplateForm do
|
|
3
3
|
let(:form) { described_class.new(permission_template) }
|
4
4
|
let(:today) { Time.zone.today }
|
5
5
|
let(:admin_set) { create(:admin_set) }
|
6
|
-
let(:collection) {
|
6
|
+
let(:collection) { build(:collection_lw) }
|
7
7
|
|
8
8
|
subject { form }
|
9
9
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec.describe Hyrax::CollectionIndexer do
|
2
2
|
let(:indexer) { described_class.new(collection) }
|
3
|
-
let(:collection) { build(:
|
3
|
+
let(:collection) { build(:collection_lw) }
|
4
4
|
let(:col1id) { 'col1' }
|
5
5
|
let(:col2id) { 'col2' }
|
6
6
|
let(:col1title) { 'col1 title' }
|
@@ -52,7 +52,7 @@ RSpec.describe CharacterizeJob do
|
|
52
52
|
|
53
53
|
context "when the file set's work is in a collection" do
|
54
54
|
let(:work) { build(:generic_work) }
|
55
|
-
let(:collection) { build(:
|
55
|
+
let(:collection) { build(:collection_lw) }
|
56
56
|
|
57
57
|
before do
|
58
58
|
allow(file_set).to receive(:parent).and_return(work)
|
@@ -10,6 +10,27 @@ RSpec.describe Hyrax::ResourceSync::ChangeListWriter, :clean_repo do
|
|
10
10
|
described_class.new(resource_host: 'example.com',
|
11
11
|
capability_list_url: capability_list)
|
12
12
|
end
|
13
|
+
let(:namespaces) do
|
14
|
+
{
|
15
|
+
'rs' => "http://www.openarchives.org/rs/terms/",
|
16
|
+
'x' => sitemap
|
17
|
+
}
|
18
|
+
end
|
19
|
+
let(:capability_element) { xml.xpath('//rs:ln/@href', 'rs' => "http://www.openarchives.org/rs/terms/") }
|
20
|
+
# The creation and modified dates are used in order to determine whether or
|
21
|
+
# not the status is "created" or "updated"
|
22
|
+
# This avoids any potential delays/conflicts when testing against Solr and
|
23
|
+
# Fedora within the testing environment
|
24
|
+
# @see Hyrax::ResourceSync::ChangeListWriter#build_resource
|
25
|
+
let(:file_set_status) do
|
26
|
+
file_set.create_date.to_i == file_set.modified_date.to_i ? 'created' : 'updated'
|
27
|
+
end
|
28
|
+
let(:public_work_status) do
|
29
|
+
public_work.create_date.to_i == public_work.modified_date.to_i ? 'created' : 'updated'
|
30
|
+
end
|
31
|
+
let(:public_collection_status) do
|
32
|
+
public_collection.create_date.to_i == public_collection.modified_date.to_i ? 'created' : 'updated'
|
33
|
+
end
|
13
34
|
|
14
35
|
subject { instance.write }
|
15
36
|
|
@@ -22,43 +43,36 @@ RSpec.describe Hyrax::ResourceSync::ChangeListWriter, :clean_repo do
|
|
22
43
|
context "when resources exist" do
|
23
44
|
before do
|
24
45
|
# These private items should not show up.
|
25
|
-
|
46
|
+
build(:private_collection_lw)
|
26
47
|
create(:work)
|
27
48
|
|
28
|
-
# Sleep in between to ensure modified dates are different
|
29
49
|
public_collection
|
30
|
-
sleep(1)
|
31
50
|
public_work
|
32
|
-
sleep(1)
|
33
51
|
file_set
|
34
52
|
end
|
35
53
|
|
36
54
|
it "has a list of resources" do
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
expect(
|
41
|
-
expect(
|
42
|
-
|
43
|
-
expect(
|
44
|
-
expect(change(2)).to eq "created"
|
45
|
-
|
46
|
-
expect(location(3)).to eq "http://example.com/collections/#{public_collection.id}"
|
47
|
-
expect(change(3)).to eq "created"
|
55
|
+
expect(capability_element.text).to eq capability_list
|
56
|
+
locations = location_elements(namespaces).map(&:text)
|
57
|
+
expect(locations).to include "http://example.com/concern/file_sets/#{file_set.id}"
|
58
|
+
expect(locations).to include "http://example.com/concern/generic_works/#{public_work.id}"
|
59
|
+
expect(locations).to include "http://example.com/collections/#{public_collection.id}"
|
60
|
+
changed = changed_elements(namespaces).map(&:value)
|
61
|
+
expect(changed).to match_array([public_collection_status, public_work_status, file_set_status])
|
48
62
|
|
49
63
|
expect(url_list.count).to eq 3
|
50
64
|
end
|
51
65
|
end
|
52
66
|
|
53
|
-
def
|
54
|
-
query(
|
67
|
+
def changed_elements(namespaces = {})
|
68
|
+
query("rs:md/@change", namespaces)
|
55
69
|
end
|
56
70
|
|
57
|
-
def
|
58
|
-
query(
|
71
|
+
def location_elements(namespaces = {})
|
72
|
+
query("x:loc", namespaces)
|
59
73
|
end
|
60
74
|
|
61
|
-
def query(
|
62
|
-
xml.xpath("//x:url
|
75
|
+
def query(part, ns = {})
|
76
|
+
xml.xpath("//x:url/#{part}", ns)
|
63
77
|
end
|
64
78
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec.describe Hyrax::ResourceSync::ResourceListWriter, :clean_repo do
|
2
2
|
let(:sitemap) { 'http://www.sitemaps.org/schemas/sitemap/0.9' }
|
3
|
-
let!(:private_collection) {
|
3
|
+
let!(:private_collection) { build(:private_collection_lw) }
|
4
4
|
let!(:public_collection) { create(:public_collection) }
|
5
5
|
let!(:public_work) { create(:public_generic_work) }
|
6
6
|
let!(:private_work) { create(:work) }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
RSpec.describe Collection, type: :model do
|
2
|
-
let(:collection) { build(:
|
2
|
+
let(:collection) { build(:public_collection_lw) }
|
3
3
|
|
4
4
|
it "has open visibility" do
|
5
5
|
expect(collection.read_groups).to eq ['public']
|
@@ -15,7 +15,7 @@ RSpec.describe Collection, type: :model do
|
|
15
15
|
|
16
16
|
describe "#to_solr" do
|
17
17
|
let(:user) { build(:user) }
|
18
|
-
let(:collection) { build(:
|
18
|
+
let(:collection) { build(:collection_lw, user: user, title: ['A good title']) }
|
19
19
|
|
20
20
|
let(:solr_document) { collection.to_solr }
|
21
21
|
|
@@ -40,7 +40,7 @@ RSpec.describe Collection, type: :model do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "#members_objects", clean_repo: true do
|
43
|
-
let(:collection) { create(:
|
43
|
+
let(:collection) { create(:collection_lw) }
|
44
44
|
|
45
45
|
it "is empty by default" do
|
46
46
|
expect(collection.member_objects).to match_array []
|
@@ -80,7 +80,7 @@ RSpec.describe Collection, type: :model do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
describe "#destroy", clean_repo: true do
|
83
|
-
let(:collection) { build(:
|
83
|
+
let(:collection) { build(:collection_lw) }
|
84
84
|
let(:work1) { create(:work) }
|
85
85
|
|
86
86
|
before do
|
@@ -130,7 +130,7 @@ RSpec.describe Collection, type: :model do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
describe '#collection_type_gid=' do
|
133
|
-
let(:collection) { build(:
|
133
|
+
let(:collection) { build(:collection_lw) }
|
134
134
|
let(:collection_type) { create(:collection_type) }
|
135
135
|
|
136
136
|
it 'sets gid' do
|
@@ -170,7 +170,7 @@ RSpec.describe Collection, type: :model do
|
|
170
170
|
end
|
171
171
|
|
172
172
|
describe 'collection type delegated methods' do
|
173
|
-
subject { build(:
|
173
|
+
subject { build(:collection_lw) }
|
174
174
|
|
175
175
|
it { is_expected.to delegate_method(:nestable?).to(:collection_type) }
|
176
176
|
it { is_expected.to delegate_method(:discoverable?).to(:collection_type) }
|
@@ -185,7 +185,7 @@ RSpec.describe Collection, type: :model do
|
|
185
185
|
|
186
186
|
describe '.after_destroy' do
|
187
187
|
it 'will destroy the associated permission template' do
|
188
|
-
collection =
|
188
|
+
collection = build(:collection_lw, with_permission_template: true)
|
189
189
|
expect { collection.destroy }.to change { Hyrax::PermissionTemplate.count }.by(-1)
|
190
190
|
end
|
191
191
|
end
|
@@ -193,7 +193,7 @@ RSpec.describe Collection, type: :model do
|
|
193
193
|
describe '#reset_access_controls!' do
|
194
194
|
let!(:user) { build(:user) }
|
195
195
|
let(:collection_type) { create(:collection_type) }
|
196
|
-
let!(:collection) {
|
196
|
+
let!(:collection) { build(:collection_lw, user: user, collection_type_gid: collection_type.gid) }
|
197
197
|
let!(:permission_template) { build(:permission_template) }
|
198
198
|
|
199
199
|
before do
|
@@ -236,20 +236,20 @@ RSpec.describe Collection, type: :model do
|
|
236
236
|
|
237
237
|
describe 'permission template' do
|
238
238
|
it 'will be created when with_permission_template is true' do
|
239
|
-
expect {
|
239
|
+
expect { build(:collection_lw, with_permission_template: true) }.to change { Hyrax::PermissionTemplate.count }.by(1)
|
240
240
|
end
|
241
241
|
|
242
242
|
it 'will be created when with_permission_template is set to attributes identifying access' do
|
243
|
-
expect {
|
244
|
-
expect {
|
243
|
+
expect { build(:collection_lw, with_permission_template: { manage_users: [user] }) }.to change { Hyrax::PermissionTemplate.count }.by(1)
|
244
|
+
expect { build(:collection_lw, with_permission_template: { manage_users: [user], deposit_users: [user] }) }.to change { Hyrax::PermissionTemplate.count }.by(1)
|
245
245
|
end
|
246
246
|
|
247
247
|
it 'will be created when create_access is true' do
|
248
|
-
expect { create(:
|
248
|
+
expect { create(:collection_lw, with_permission_template: true) }.to change { Hyrax::PermissionTemplate.count }.by(1)
|
249
249
|
end
|
250
250
|
|
251
251
|
it 'will not be created by default' do
|
252
|
-
expect {
|
252
|
+
expect { build(:collection_lw) }.not_to change { Hyrax::PermissionTemplate.count }
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
@@ -264,11 +264,11 @@ RSpec.describe Collection, type: :model do
|
|
264
264
|
end
|
265
265
|
|
266
266
|
it 'will be created when create_access is true' do
|
267
|
-
expect {
|
267
|
+
expect { build(:collection_lw, user: user, with_permission_template: true) }.to change { Hyrax::PermissionTemplate.count }.by(1)
|
268
268
|
end
|
269
269
|
|
270
270
|
it 'will not be created by default' do
|
271
|
-
expect {
|
271
|
+
expect { build(:collection_lw) }.not_to change { Hyrax::PermissionTemplateAccess.count }
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
@@ -293,7 +293,7 @@ RSpec.describe Collection, type: :model do
|
|
293
293
|
|
294
294
|
context 'when building a collection' do
|
295
295
|
let(:coll123) do
|
296
|
-
build(:
|
296
|
+
build(:collection_lw,
|
297
297
|
id: 'Collection123',
|
298
298
|
collection_type_gid: collection_type.gid,
|
299
299
|
with_nesting_attributes:
|
@@ -318,8 +318,8 @@ RSpec.describe Collection, type: :model do
|
|
318
318
|
end
|
319
319
|
|
320
320
|
describe '#update_nested_collection_relationship_indices', :with_nested_reindexing do
|
321
|
-
it 'will be called
|
322
|
-
expect(Samvera::NestingIndexer).to receive(:reindex_relationships).with(id: kind_of(String), extent: kind_of(String))
|
321
|
+
it 'will be called once for the Collection resource and once for the nested ACL permission resource' do
|
322
|
+
expect(Samvera::NestingIndexer).to receive(:reindex_relationships).exactly(2).times.with(id: kind_of(String), extent: kind_of(String))
|
323
323
|
collection.save!
|
324
324
|
end
|
325
325
|
end
|
@@ -31,8 +31,8 @@ RSpec.describe Hyrax::CollectionNesting do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
let(:user) { create(:user) }
|
34
|
-
let!(:collection) {
|
35
|
-
let!(:child_collection) { create(:
|
34
|
+
let!(:collection) { build(:collection_lw, collection_type_settings: [:nestable]) }
|
35
|
+
let!(:child_collection) { create(:collection_lw, collection_type_settings: [:nestable]) }
|
36
36
|
let(:extent) { Hyrax::Adapters::NestingIndexAdapter::FULL_REINDEX }
|
37
37
|
|
38
38
|
before do
|
@@ -134,7 +134,7 @@ RSpec.describe Hyrax::CollectionType, type: :model do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
describe "collections" do
|
137
|
-
let!(:collection) { create(:
|
137
|
+
let!(:collection) { create(:collection_lw, collection_type_gid: collection_type.gid.to_s) }
|
138
138
|
let(:collection_type) { create(:collection_type) }
|
139
139
|
|
140
140
|
it 'returns collections of this collection type' do
|
@@ -151,7 +151,7 @@ RSpec.describe Hyrax::CollectionType, type: :model do
|
|
151
151
|
let(:collection_type) { create(:collection_type) }
|
152
152
|
|
153
153
|
it 'returns true if there are any collections of this collection type' do
|
154
|
-
create(:
|
154
|
+
create(:collection_lw, collection_type_gid: collection_type.gid.to_s)
|
155
155
|
expect(collection_type).to have_collections
|
156
156
|
end
|
157
157
|
it 'returns false if there are not any collections of this collection type' do
|
@@ -11,7 +11,7 @@ RSpec.describe Hyrax::CollectionPresenter do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
let(:collection) do
|
14
|
-
build(:
|
14
|
+
build(:collection_lw,
|
15
15
|
id: 'adc12v',
|
16
16
|
description: ['a nice collection'],
|
17
17
|
based_near: ['Over there'],
|
@@ -61,7 +61,7 @@ RSpec.describe Hyrax::CollectionPresenter do
|
|
61
61
|
let(:collection_type) { create(:collection_type) }
|
62
62
|
|
63
63
|
describe 'when solr_document#collection_type_gid exists' do
|
64
|
-
let(:collection) { build(:
|
64
|
+
let(:collection) { build(:collection_lw, collection_type_gid: collection_type.gid) }
|
65
65
|
let(:solr_doc) { SolrDocument.new(collection.to_solr) }
|
66
66
|
|
67
67
|
it 'finds the collection type based on the solr_document#collection_type_gid if one exists' do
|
@@ -173,7 +173,7 @@ RSpec.describe Hyrax::CollectionPresenter do
|
|
173
173
|
end
|
174
174
|
|
175
175
|
context "collection with private collection" do
|
176
|
-
let!(:work) {
|
176
|
+
let!(:work) { build(:private_collection_lw, member_of_collections: [collection]) }
|
177
177
|
|
178
178
|
it { is_expected.to eq 0 }
|
179
179
|
end
|
@@ -185,14 +185,14 @@ RSpec.describe Hyrax::CollectionPresenter do
|
|
185
185
|
end
|
186
186
|
|
187
187
|
context "collection with public collection" do
|
188
|
-
let!(:subcollection) { create(:
|
188
|
+
let!(:subcollection) { create(:public_collection_lw, member_of_collections: [collection]) }
|
189
189
|
|
190
190
|
it { is_expected.to eq 1 }
|
191
191
|
end
|
192
192
|
|
193
193
|
context "collection with public work and sub-collection" do
|
194
194
|
let!(:work) { create(:public_work, member_of_collections: [collection]) }
|
195
|
-
let!(:subcollection) { create(:
|
195
|
+
let!(:subcollection) { create(:public_collection_lw, member_of_collections: [collection]) }
|
196
196
|
|
197
197
|
it { is_expected.to eq 2 }
|
198
198
|
end
|
@@ -232,7 +232,7 @@ RSpec.describe Hyrax::CollectionPresenter do
|
|
232
232
|
|
233
233
|
context "collection with public work and sub-collection" do
|
234
234
|
let!(:work) { create(:public_work, member_of_collections: [collection]) }
|
235
|
-
let!(:subcollection) { create(:
|
235
|
+
let!(:subcollection) { create(:public_collection_lw, member_of_collections: [collection]) }
|
236
236
|
|
237
237
|
it { is_expected.to eq 1 }
|
238
238
|
end
|
@@ -259,20 +259,20 @@ RSpec.describe Hyrax::CollectionPresenter do
|
|
259
259
|
end
|
260
260
|
|
261
261
|
context "collection with private collection" do
|
262
|
-
let!(:subcollection) {
|
262
|
+
let!(:subcollection) { build(:private_collection_lw, member_of_collections: [collection]) }
|
263
263
|
|
264
264
|
it { is_expected.to eq 0 }
|
265
265
|
end
|
266
266
|
|
267
267
|
context "collection with public collection" do
|
268
|
-
let!(:subcollection) { create(:
|
268
|
+
let!(:subcollection) { create(:public_collection_lw, member_of_collections: [collection]) }
|
269
269
|
|
270
270
|
it { is_expected.to eq 1 }
|
271
271
|
end
|
272
272
|
|
273
273
|
context "collection with public work and sub-collection" do
|
274
274
|
let!(:work) { create(:public_work, member_of_collections: [collection]) }
|
275
|
-
let!(:subcollection) { create(:
|
275
|
+
let!(:subcollection) { create(:public_collection_lw, member_of_collections: [collection]) }
|
276
276
|
|
277
277
|
it { is_expected.to eq 1 }
|
278
278
|
end
|
@@ -310,8 +310,8 @@ RSpec.describe Hyrax::CollectionPresenter do
|
|
310
310
|
end
|
311
311
|
|
312
312
|
context('when parent_collections is has collections') do
|
313
|
-
let(:collection1) { build(:
|
314
|
-
let(:collection2) { build(:
|
313
|
+
let(:collection1) { build(:collection_lw, title: ['col1']) }
|
314
|
+
let(:collection2) { build(:collection_lw, title: ['col2']) }
|
315
315
|
let!(:parent_docs) { [collection1, collection2] }
|
316
316
|
|
317
317
|
before do
|
@@ -2,7 +2,7 @@ RSpec.describe Hyrax::CollectionMemberSearchBuilder do
|
|
2
2
|
let(:context) { double("context", blacklight_config: CatalogController.blacklight_config) }
|
3
3
|
let(:solr_params) { { fq: [] } }
|
4
4
|
let(:include_models) { :both }
|
5
|
-
let(:collection) { build(:
|
5
|
+
let(:collection) { build(:collection_lw, id: '12345') }
|
6
6
|
let(:builder) { described_class.new(scope: context, collection: collection, search_includes_models: include_models) }
|
7
7
|
|
8
8
|
describe ".default_processor_chain" do
|
@@ -50,7 +50,7 @@ RSpec.describe Hyrax::CollectionSearchBuilder do
|
|
50
50
|
|
51
51
|
context 'when access is :deposit' do
|
52
52
|
let(:access) { "deposit" }
|
53
|
-
let!(:collection) { create(:
|
53
|
+
let!(:collection) { create(:collection_lw, with_permission_template: attributes) }
|
54
54
|
|
55
55
|
context 'and user has access' do
|
56
56
|
let(:attributes) { { deposit_users: [user.user_key] } }
|