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.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +139 -69
  3. data/.travis.yml +4 -1
  4. data/README.md +2 -2
  5. data/app/actors/hyrax/actors/transactional_request.rb +8 -8
  6. data/app/services/hyrax/default_middleware_stack.rb +4 -2
  7. data/app/views/catalog/_thumbnail_list_collection.html.erb +3 -2
  8. data/hyrax.gemspec +3 -6
  9. data/lib/hyrax/version.rb +1 -1
  10. data/spec/abilities/collection_ability_spec.rb +5 -5
  11. data/spec/abilities/permission_template_ability_spec.rb +1 -1
  12. data/spec/actors/hyrax/actors/collections_membership_actor_spec.rb +5 -5
  13. data/spec/actors/hyrax/actors/transactional_request_spec.rb +4 -2
  14. data/spec/controllers/catalog_controller_spec.rb +1 -1
  15. data/spec/controllers/hyrax/admin/collection_types_controller_spec.rb +1 -1
  16. data/spec/controllers/hyrax/batch_edits_controller_spec.rb +9 -9
  17. data/spec/controllers/hyrax/collections_controller_spec.rb +5 -5
  18. data/spec/controllers/hyrax/dashboard/collection_members_controller_spec.rb +16 -13
  19. data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +8 -8
  20. data/spec/controllers/hyrax/dashboard/nest_collections_controller_spec.rb +1 -1
  21. data/spec/controllers/hyrax/generic_works_controller_spec.rb +1 -1
  22. data/spec/controllers/hyrax/my/shares_controller_spec.rb +1 -1
  23. data/spec/features/actor_stack_spec.rb +48 -0
  24. data/spec/features/catalog_search_spec.rb +2 -2
  25. data/spec/features/collection_multi_membership_spec.rb +2 -2
  26. data/spec/features/collection_spec.rb +7 -7
  27. data/spec/features/collection_type_spec.rb +2 -2
  28. data/spec/features/dashboard/collection_spec.rb +15 -15
  29. data/spec/features/search_spec.rb +2 -2
  30. data/spec/features/work_show_spec.rb +5 -2
  31. data/spec/forms/hyrax/forms/collection_form_spec.rb +5 -5
  32. data/spec/forms/hyrax/forms/permission_template_form_spec.rb +1 -1
  33. data/spec/indexers/hyrax/collection_indexer_spec.rb +1 -1
  34. data/spec/jobs/characterize_job_spec.rb +1 -1
  35. data/spec/lib/hyrax/resource_sync/change_list_writer_spec.rb +35 -21
  36. data/spec/lib/hyrax/resource_sync/resource_list_writer_spec.rb +1 -1
  37. data/spec/models/collection_spec.rb +18 -18
  38. data/spec/models/concerns/hyrax/collection_nesting_spec.rb +2 -2
  39. data/spec/models/hyrax/collection_type_spec.rb +2 -2
  40. data/spec/presenters/hyrax/collection_presenter_spec.rb +11 -11
  41. data/spec/search_builders/hyrax/collection_member_search_builder_spec.rb +1 -1
  42. data/spec/search_builders/hyrax/collection_search_builder_spec.rb +1 -1
  43. data/spec/search_builders/hyrax/dashboard/nested_collections_search_builder_spec.rb +1 -1
  44. data/spec/search_builders/hyrax/work_relation_spec.rb +1 -1
  45. data/spec/services/hyrax/adapters/nesting_index_adapter_spec.rb +2 -2
  46. data/spec/services/hyrax/collections/collection_member_service_spec.rb +2 -2
  47. data/spec/services/hyrax/collections/migration_service_spec.rb +27 -27
  48. data/spec/services/hyrax/collections/nested_collection_persistence_service_spec.rb +1 -1
  49. data/spec/services/hyrax/collections/nested_collection_query_service_spec.rb +38 -38
  50. data/spec/services/hyrax/statistics/depositors/summary_spec.rb +1 -1
  51. data/spec/services/hyrax/statistics/works/by_resource_type_spec.rb +11 -4
  52. data/spec/spec_helper.rb +10 -8
  53. data/spec/support/selectors.rb +10 -1
  54. data/spec/views/catalog/_thumbnail_list_collection.html.erb_spec.rb +38 -5
  55. data/template.rb +3 -1
  56. metadata +23 -21
@@ -16,7 +16,7 @@ RSpec.describe Hyrax::Actors::CollectionsMembershipActor do
16
16
  end
17
17
 
18
18
  describe 'the next actor' do
19
- let(:collection) { create(:collection, create_access: true) }
19
+ let(:collection) { build(:collection_lw, with_permission_template: true) }
20
20
  let(:attributes) do
21
21
  {
22
22
  member_of_collections_attributes: { '0' => { id: '123' } },
@@ -68,7 +68,7 @@ RSpec.describe Hyrax::Actors::CollectionsMembershipActor do
68
68
  end
69
69
 
70
70
  context "when work is in user's own collection and destroy is passed" do
71
- let(:collection) { create(:collection, user: user, title: ['A good title'], create_access: true) }
71
+ let(:collection) { build(:collection_lw, user: user, title: ['A good title'], with_permission_template: true) }
72
72
  let(:attributes) do
73
73
  { member_of_collections_attributes: { '0' => { id: collection.id, _destroy: 'true' } } }
74
74
  end
@@ -86,7 +86,7 @@ RSpec.describe Hyrax::Actors::CollectionsMembershipActor do
86
86
 
87
87
  context "when work is in another user's collection" do
88
88
  let(:other_user) { create(:user) }
89
- let(:other_collection) { create(:collection, user: other_user, title: ['A good title'], create_access: true) }
89
+ let(:other_collection) { build(:collection_lw, user: other_user, title: ['A good title'], with_permission_template: true) }
90
90
 
91
91
  before do
92
92
  curation_concern.member_of_collections = [other_collection]
@@ -172,7 +172,7 @@ RSpec.describe Hyrax::Actors::CollectionsMembershipActor do
172
172
 
173
173
  context "updates env" do
174
174
  let!(:collection_type) { create(:collection_type) }
175
- let!(:collection) { create(:collection, collection_type_gid: collection_type.gid, create_access: true) }
175
+ let!(:collection) { create(:collection_lw, collection_type_gid: collection_type.gid, with_permission_template: true) }
176
176
 
177
177
  subject(:middleware) do
178
178
  stack = ActionDispatch::MiddlewareStack.new.tap do |middleware|
@@ -205,7 +205,7 @@ RSpec.describe Hyrax::Actors::CollectionsMembershipActor do
205
205
  end
206
206
 
207
207
  context "when more than one collection" do
208
- let(:collection2) { create(:collection, create_access: true) }
208
+ let(:collection2) { create(:collection_lw, with_permission_template: true) }
209
209
  let(:attributes) do
210
210
  {
211
211
  member_of_collections_attributes: {
@@ -35,10 +35,12 @@ RSpec.describe Hyrax::Actors::TransactionalRequest do
35
35
 
36
36
  subject { middleware.create(env) }
37
37
 
38
- it "rolls back any database changes" do
38
+ # Note that this test changed behavior with the
39
+ # backport of https://github.com/samvera/hyrax/pull/3482
40
+ it "does NOT roll back any database changes" do
39
41
  expect do
40
42
  expect { subject }.to raise_error 'boom'
41
- end.not_to change { User.count } # Note the above good actor creates a user
43
+ end.to change { User.count } # Note the above good actor creates a user
42
44
  end
43
45
  end
44
46
  end
@@ -39,7 +39,7 @@ RSpec.describe CatalogController, type: :controller do
39
39
  end
40
40
 
41
41
  context 'with collections' do
42
- let(:collection) { create(:public_collection, keyword: ['rocks']) }
42
+ let(:collection) { create(:public_collection_lw, keyword: ['rocks']) }
43
43
  let(:objects) { [collection, rocks, clouds] }
44
44
 
45
45
  it 'finds collections' do
@@ -306,7 +306,7 @@ RSpec.describe Hyrax::Admin::CollectionTypesController, type: :controller, clean
306
306
  end
307
307
 
308
308
  context "when collections exist of this type" do
309
- let!(:collection) { create(:collection, collection_type_gid: collection_type_to_destroy.gid) }
309
+ let!(:collection) { create(:collection_lw, collection_type_gid: collection_type_to_destroy.gid) }
310
310
 
311
311
  it "doesn't delete the collection type or collection" do
312
312
  delete :destroy, params: { id: collection_type_to_destroy }
@@ -174,15 +174,15 @@ RSpec.describe Hyrax::BatchEditsController, type: :controller do
174
174
  let(:user) { create(:user) }
175
175
 
176
176
  let(:collection1) do
177
- create(:public_collection, title: ["My First Collection"],
178
- description: ["My incredibly detailed description of the collection"],
179
- user: user)
177
+ create(:public_collection_lw, title: ["My First Collection"],
178
+ description: ["My incredibly detailed description of the collection"],
179
+ user: user)
180
180
  end
181
181
 
182
182
  let(:collection2) do
183
- create(:public_collection, title: ["My Other Collection"],
184
- description: ["My incredibly detailed description of the other collection"],
185
- user: user)
183
+ create(:public_collection_lw, title: ["My Other Collection"],
184
+ description: ["My incredibly detailed description of the other collection"],
185
+ user: user)
186
186
  end
187
187
 
188
188
  let!(:work1) { create(:work, title: ["First of the Assets"], member_of_collections: [collection1], user: user) }
@@ -204,9 +204,9 @@ RSpec.describe Hyrax::BatchEditsController, type: :controller do
204
204
  let(:user2) { create(:user) }
205
205
 
206
206
  let(:collection3) do
207
- create(:public_collection, title: ["User2's Collection"],
208
- description: ["Collection created by user2"],
209
- user: user2)
207
+ create(:public_collection_lw, title: ["User2's Collection"],
208
+ description: ["Collection created by user2"],
209
+ user: user2)
210
210
  end
211
211
 
212
212
  before do
@@ -4,16 +4,16 @@ RSpec.describe Hyrax::CollectionsController do
4
4
  let(:other) { build(:user) }
5
5
 
6
6
  let(:collection) do
7
- create(:public_collection, title: ["My collection"],
8
- description: ["My incredibly detailed description of the collection"],
9
- user: user)
7
+ create(:public_collection_lw, title: ["My collection"],
8
+ description: ["My incredibly detailed description of the collection"],
9
+ user: user)
10
10
  end
11
11
 
12
12
  let(:asset1) { create(:work, title: ["First of the Assets"], user: user) }
13
13
  let(:asset2) { create(:work, title: ["Second of the Assets"], user: user) }
14
14
  let(:asset3) { create(:work, title: ["Third of the Assets"], user: user) }
15
- let(:asset4) { create(:collection, title: ["First subcollection"], user: user) }
16
- let(:asset5) { create(:collection, title: ["Second subcollection"], user: user) }
15
+ let(:asset4) { build(:collection_lw, title: ["First subcollection"], user: user) }
16
+ let(:asset5) { build(:collection_lw, title: ["Second subcollection"], user: user) }
17
17
  let(:unowned_asset) { create(:work, user: other) }
18
18
 
19
19
  let(:collection_attrs) do
@@ -10,20 +10,23 @@ RSpec.describe Hyrax::Dashboard::CollectionMembersController, :clean_repo do
10
10
  let(:work_5_read) { create(:work, id: 'work-5-read', title: ["Other's work with read access"], user: other, read_users: [user]) }
11
11
  let(:work_6_noaccess) { create(:work, id: 'work-6-no_access', title: ["Other's work with no access"], user: other) }
12
12
 
13
- let(:coll_1_own) { create(:private_collection, id: 'col-1-own', title: ['User created'], user: user, create_access: true) }
13
+ let(:coll_1_own) { create(:private_collection_lw, id: 'col-1-own', title: ['User created'], user: user, with_permission_template: true) }
14
14
  let(:coll_2_mgr) do
15
- create(:private_collection, id: 'col-2-mgr', title: ['User has manage access'], user: other,
16
- with_permission_template: { manage_users: [user] }, create_access: true)
15
+ create(:private_collection_lw, id: 'col-2-mgr', title: ['User has manage access'], user: other,
16
+ with_permission_template: { manage_users: [user] })
17
17
  end
18
18
  let(:coll_3_dep) do
19
- create(:private_collection, id: 'col-3-dep', title: ['User has deposit access'], user: other,
20
- with_permission_template: { deposit_users: [user] }, create_access: true)
19
+ create(:private_collection_lw, id: 'col-3-dep', title: ['User has deposit access'], user: other,
20
+ with_permission_template: { deposit_users: [user] })
21
21
  end
22
22
  let(:coll_4_view) do
23
- create(:private_collection, id: 'col-4-dep', title: ['User has view access'], user: other,
24
- with_permission_template: { view_users: [user] }, create_access: true)
23
+ create(:private_collection_lw, id: 'col-4-dep', title: ['User has view access'], user: other,
24
+ with_permission_template: { view_users: [user] })
25
+ end
26
+ let(:coll_5_noaccess) do
27
+ create(:private_collection_lw, id: 'col-5-no_access', title: ['Other user created'],
28
+ user: other, with_permission_template: true)
25
29
  end
26
- let(:coll_5_noaccess) { create(:private_collection, id: 'col-5-no_access', title: ['Other user created'], user: other, create_access: true) }
27
30
 
28
31
  describe '#update_members' do
29
32
  context 'when user created the collection' do
@@ -95,7 +98,7 @@ RSpec.describe Hyrax::Dashboard::CollectionMembersController, :clean_repo do
95
98
  end
96
99
 
97
100
  context 'and user adds a subcollection' do
98
- let(:parent_collection) { create(:private_collection, id: 'pcol', title: ['User created another'], user: user, create_access: true) }
101
+ let(:parent_collection) { create(:private_collection_lw, id: 'pcol', title: ['User created another'], user: user, with_permission_template: true) }
99
102
 
100
103
  it 'adds collection user created' do
101
104
  expect do
@@ -209,8 +212,8 @@ RSpec.describe Hyrax::Dashboard::CollectionMembersController, :clean_repo do
209
212
 
210
213
  context 'and user adds a subcollection' do
211
214
  let(:parent_collection) do
212
- create(:private_collection, id: 'pcol-mgr', title: ['User has manage access to another'], user: other,
213
- with_permission_template: { manage_users: [user] }, create_access: true)
215
+ create(:private_collection_lw, id: 'pcol-mgr', title: ['User has manage access to another'], user: other,
216
+ with_permission_template: { manage_users: [user] })
214
217
  end
215
218
 
216
219
  it 'adds collection user created' do
@@ -325,8 +328,8 @@ RSpec.describe Hyrax::Dashboard::CollectionMembersController, :clean_repo do
325
328
 
326
329
  context 'and user adds a subcollection' do
327
330
  let(:parent_collection) do
328
- create(:private_collection, id: 'pcol-dep', title: ['User has deposit access to another'], user: other,
329
- with_permission_template: { deposit_users: [user] }, create_access: true)
331
+ create(:private_collection_lw, id: 'pcol-dep', title: ['User has deposit access to another'], user: other,
332
+ with_permission_template: { deposit_users: [user] })
330
333
  end
331
334
 
332
335
  it 'adds collection user created' do
@@ -5,16 +5,16 @@ RSpec.describe Hyrax::Dashboard::CollectionsController, :clean_repo do
5
5
  let(:collection_type_gid) { create(:user_collection_type).gid }
6
6
 
7
7
  let(:collection) do
8
- create(:public_collection, title: ["My collection"],
9
- description: ["My incredibly detailed description of the collection"],
10
- user: user)
8
+ create(:public_collection_lw, title: ["My collection"],
9
+ description: ["My incredibly detailed description of the collection"],
10
+ user: user)
11
11
  end
12
12
 
13
13
  let(:asset1) { create(:work, title: ["First of the Assets"], user: user) }
14
14
  let(:asset2) { create(:work, title: ["Second of the Assets"], user: user) }
15
15
  let(:asset3) { create(:work, title: ["Third of the Assets"], user: user) }
16
- let(:asset4) { create(:collection, title: ["First subcollection"], user: user) }
17
- let(:asset5) { create(:collection, title: ["Second subcollection"], user: user) }
16
+ let(:asset4) { build(:collection_lw, title: ["First subcollection"], user: user) }
17
+ let(:asset5) { build(:collection_lw, title: ["Second subcollection"], user: user) }
18
18
  let(:unowned_asset) { create(:work, user: other) }
19
19
 
20
20
  let(:collection_attrs) do
@@ -112,7 +112,7 @@ RSpec.describe Hyrax::Dashboard::CollectionsController, :clean_repo do
112
112
  end
113
113
 
114
114
  context "when params includes parent_id" do
115
- let(:parent_collection) { create(:collection, title: ['Parent']) }
115
+ let(:parent_collection) { create(:collection_lw, title: ['Parent']) }
116
116
 
117
117
  it "creates a collection as a subcollection of parent" do
118
118
  parent_collection
@@ -189,7 +189,7 @@ RSpec.describe Hyrax::Dashboard::CollectionsController, :clean_repo do
189
189
  let(:asset1) { create(:generic_work, user: user) }
190
190
  let(:asset2) { create(:generic_work, user: user) }
191
191
  let(:asset3) { create(:generic_work, user: user) }
192
- let(:collection2) { create(:collection, title: ['Some Collection'], user: user) }
192
+ let(:collection2) { create(:collection_lw, title: ['Some Collection'], user: user) }
193
193
 
194
194
  before do
195
195
  [asset1, asset2, asset3].each do |asset|
@@ -233,7 +233,7 @@ RSpec.describe Hyrax::Dashboard::CollectionsController, :clean_repo do
233
233
  end
234
234
 
235
235
  context "when update fails" do
236
- let(:collection) { create(:collection, id: '12345') }
236
+ let(:collection) { build(:collection_lw, id: '12345') }
237
237
  let(:repository) { instance_double(Blacklight::Solr::Repository, search: result) }
238
238
  let(:result) { double(documents: [], total: 0) }
239
239
 
@@ -2,7 +2,7 @@ RSpec.describe Hyrax::Dashboard::NestCollectionsController do
2
2
  routes { Hyrax::Engine.routes }
3
3
  let(:child_id) { 'child1' }
4
4
  let(:child) { instance_double(Collection, title: ["Awesome Child"]) }
5
- let(:parent) { create(:collection, id: 'parent1', collection_type_settings: :nestable, title: ["Uncool Parent"]) }
5
+ let(:parent) { create(:collection_lw, id: 'parent1', collection_type_settings: :nestable, title: ["Uncool Parent"]) }
6
6
 
7
7
  describe '#blacklight_config' do
8
8
  subject { controller.blacklight_config }
@@ -534,7 +534,7 @@ RSpec.describe Hyrax::GenericWorksController do
534
534
 
535
535
  describe '#destroy' do
536
536
  let(:work_to_be_deleted) { create(:private_generic_work, user: user) }
537
- let(:parent_collection) { create(:collection) }
537
+ let(:parent_collection) { build(:collection_lw) }
538
538
 
539
539
  it 'deletes the work' do
540
540
  delete :destroy, params: { id: work_to_be_deleted }
@@ -15,7 +15,7 @@ RSpec.describe Hyrax::My::SharesController, type: :controller do
15
15
  let!(:shared_with_me) { create(:work, user: other_user, edit_users: [user, other_user]) }
16
16
  let!(:read_shared_with_me) { create(:work, user: other_user, read_users: [user, other_user]) }
17
17
  let!(:shared_with_someone_else) { create(:work, user: other_user, edit_users: [someone_else, other_user]) }
18
- let!(:my_collection) { create(:public_collection, user: user) }
18
+ let!(:my_collection) { create(:public_collection_lw, user: user) }
19
19
 
20
20
  it "responds with success" do
21
21
  get :index
@@ -0,0 +1,48 @@
1
+ require 'rails_helper'
2
+
3
+ # Integration tests for the full midddleware stack
4
+ RSpec.describe Hyrax::DefaultMiddlewareStack, :clean_repo do
5
+ subject(:actor) { stack.build(Hyrax::Actors::Terminator.new) }
6
+ let(:ability) { ::Ability.new(user) }
7
+ let(:attributes) { {} }
8
+ let(:stack) { described_class.build_stack }
9
+ let(:terminator) { Hyrax::Actors::Terminator.new }
10
+ let(:user) { FactoryBot.create(:user) }
11
+ let(:work) { FactoryBot.build(:work) }
12
+ let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) }
13
+
14
+ let(:delayed_failure_actor) do
15
+ Class.new(Hyrax::Actors::AbstractActor) do
16
+ def create(env)
17
+ next_actor.create(env) && raise('ALWAYS RAISE')
18
+ end
19
+ end
20
+ end
21
+
22
+ describe '#create' do
23
+ it 'persists the work' do
24
+ expect { actor.create(env) }
25
+ .to change { work.persisted? }
26
+ .to true
27
+ end
28
+
29
+ context 'when failing on the way back up the actor stack' do
30
+ before { stack.insert_before(Hyrax::Actors::ModelActor, delayed_failure_actor) }
31
+
32
+ before(:context) do
33
+ Hyrax.config.enable_noids = true
34
+ # we need to mint once to set the `rand` database column and
35
+ # make minter behavior predictable
36
+ ::Noid::Rails.config.minter_class.new.mint
37
+ end
38
+
39
+ after(:context) { Hyrax.config.enable_noids = false }
40
+
41
+ it 'leaves a valid minter state', :aggregate_failures do
42
+ expect { actor.create(env) }.to raise_error 'ALWAYS RAISE'
43
+
44
+ expect(GenericWork.new.assign_id).not_to eq work.id
45
+ end
46
+ end
47
+ end
48
+ end
@@ -14,7 +14,7 @@ RSpec.describe 'catalog searching', type: :feature do
14
14
  create(:public_work, title: ["Jack's Research"], keyword: ['jacks_keyword', 'shared_keyword'])
15
15
  end
16
16
 
17
- let!(:collection) { create(:public_collection, keyword: ['collection_keyword', 'shared_keyword']) }
17
+ let!(:collection) { create(:public_collection_lw, keyword: ['collection_keyword', 'shared_keyword']) }
18
18
 
19
19
  it 'performing a search' do
20
20
  within('#search-form-header') do
@@ -30,7 +30,7 @@ RSpec.describe 'catalog searching', type: :feature do
30
30
  end
31
31
 
32
32
  context 'with public works and private collections', clean_repo: true do
33
- let!(:collection) { create(:private_collection) }
33
+ let!(:collection) { build(:private_collection_lw) }
34
34
 
35
35
  let!(:jills_work) do
36
36
  create(:public_work, title: ["Jill's Research"], keyword: ['jills_keyword'], member_of_collections: [collection])
@@ -11,7 +11,7 @@ RSpec.describe 'Adding a work to multiple collections', type: :feature, clean_re
11
11
  end
12
12
 
13
13
  describe 'when both collections support multiple membership' do
14
- let(:old_collection) { create(:collection_lw, user: admin_user, collection_type_gid: multi_membership_type_1.gid, title: ['OldCollectionTitle']) }
14
+ let(:old_collection) { build(:collection_lw, user: admin_user, collection_type_gid: multi_membership_type_1.gid, title: ['OldCollectionTitle']) }
15
15
  let!(:work) { create(:generic_work, user: admin_user, member_of_collections: [old_collection], title: ['The highly valued work that everyone wants in their collection']) }
16
16
 
17
17
  context 'and are of different types' do
@@ -56,7 +56,7 @@ RSpec.describe 'Adding a work to multiple collections', type: :feature, clean_re
56
56
  end
57
57
 
58
58
  describe 'when both collections require single membership' do
59
- let(:old_collection) { create(:collection_lw, user: admin_user, collection_type_gid: single_membership_type_1.gid, title: ['OldCollectionTitle']) }
59
+ let(:old_collection) { build(:collection_lw, user: admin_user, collection_type_gid: single_membership_type_1.gid, title: ['OldCollectionTitle']) }
60
60
  let!(:work) do
61
61
  create(:generic_work,
62
62
  user: admin_user,
@@ -1,17 +1,17 @@
1
1
  RSpec.describe 'collection', type: :feature, clean_repo: true do
2
2
  let(:user) { create(:user) }
3
3
 
4
- let(:collection1) { create(:public_collection, user: user) }
5
- let(:collection2) { create(:public_collection, user: user) }
4
+ let(:collection1) { create(:public_collection_lw, user: user) }
5
+ let(:collection2) { create(:public_collection_lw, user: user) }
6
6
 
7
7
  describe 'collection show page' do
8
8
  let(:collection) do
9
- create(:public_collection, user: user, description: ['collection description'], collection_type_settings: :nestable)
9
+ create(:public_collection_lw, user: user, description: ['collection description'], collection_type_settings: :nestable)
10
10
  end
11
11
  let!(:work1) { create(:work, title: ["King Louie"], member_of_collections: [collection], user: user) }
12
12
  let!(:work2) { create(:work, title: ["King Kong"], member_of_collections: [collection], user: user) }
13
- let!(:col1) { create(:public_collection, title: ["Sub-collection 1"], member_of_collections: [collection], user: user) }
14
- let!(:col2) { create(:public_collection, title: ["Sub-collection 2"], member_of_collections: [collection], user: user) }
13
+ let!(:col1) { create(:public_collection_lw, title: ["Sub-collection 1"], member_of_collections: [collection], user: user) }
14
+ let!(:col2) { create(:public_collection_lw, title: ["Sub-collection 2"], member_of_collections: [collection], user: user) }
15
15
 
16
16
  before do
17
17
  sign_in user
@@ -90,7 +90,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
90
90
 
91
91
  sign_in user
92
92
  end
93
- let(:collection) { create(:named_collection, user: user) }
93
+ let(:collection) { create(:named_collection_lw, user: user) }
94
94
 
95
95
  it "shows a collection with a listing of Descriptive Metadata and catalog-style search results" do
96
96
  visit "/collections/#{collection.id}"
@@ -112,7 +112,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
112
112
 
113
113
  sign_in user
114
114
  end
115
- let(:collection) { create(:named_collection, user: user) }
115
+ let(:collection) { create(:named_collection_lw, user: user) }
116
116
 
117
117
  it "shows a collection with a listing of Descriptive Metadata and catalog-style search results" do
118
118
  visit "/collections/#{collection.id}"
@@ -292,7 +292,7 @@ RSpec.describe 'collection_type', type: :feature, clean_repo: true do
292
292
  end
293
293
 
294
294
  context 'when collections exist of this type' do
295
- let!(:collection1) { create(:public_collection, user: build(:user), collection_type_gid: exhibit_collection_type.gid) }
295
+ let!(:collection1) { create(:public_collection_lw, user: build(:user), collection_type_gid: exhibit_collection_type.gid) }
296
296
 
297
297
  before do
298
298
  exhibit_collection_type
@@ -352,7 +352,7 @@ RSpec.describe 'collection_type', type: :feature, clean_repo: true do
352
352
 
353
353
  context 'when collections exist of this type' do
354
354
  let!(:not_empty_collection_type) { create(:collection_type, title: 'Not Empty Type', creator_user: admin_user) }
355
- let!(:collection1) { create(:public_collection, user: admin_user, collection_type_gid: not_empty_collection_type.gid) }
355
+ let!(:collection1) { create(:public_collection_lw, user: admin_user, collection_type_gid: not_empty_collection_type.gid) }
356
356
  let(:deny_delete_modal_text) do
357
357
  'You cannot delete this collection type because one or more collections of this type have already been created. ' \
358
358
  'To delete this collection type, first ensure that all collections of this type have been deleted.'
@@ -11,10 +11,10 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
11
11
  # Setting Title on admin sets to avoid false positive matches with collections.
12
12
  let(:admin_set_a) { create(:admin_set, creator: [admin_user.user_key], title: ['Set A'], with_permission_template: true) }
13
13
  let(:admin_set_b) { create(:admin_set, creator: [user.user_key], title: ['Set B'], edit_users: [user.user_key], with_permission_template: true) }
14
- let(:collection1) { create(:public_collection, user: user, collection_type_gid: collection_type.gid, create_access: true) }
15
- let(:collection2) { create(:public_collection, user: user, collection_type_gid: collection_type.gid, create_access: true) }
16
- let(:collection3) { create(:public_collection, user: admin_user, collection_type_gid: collection_type.gid, create_access: true) }
17
- let(:collection4) { create(:public_collection, user: admin_user, collection_type_gid: user_collection_type.gid, create_access: true) }
14
+ let(:collection1) { create(:public_collection_lw, user: user, collection_type_gid: collection_type.gid, with_permission_template: true) }
15
+ let(:collection2) { create(:public_collection_lw, user: user, collection_type_gid: collection_type.gid, with_permission_template: true) }
16
+ let(:collection3) { create(:public_collection_lw, user: admin_user, collection_type_gid: collection_type.gid, with_permission_template: true) }
17
+ let(:collection4) { create(:public_collection_lw, user: admin_user, collection_type_gid: user_collection_type.gid, with_permission_template: true) }
18
18
 
19
19
  describe 'Your Collections tab' do
20
20
  context 'when non-admin user' do
@@ -328,8 +328,8 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
328
328
  end
329
329
 
330
330
  describe 'delete collection' do
331
- let!(:empty_collection) { create(:public_collection, title: ['Empty Collection'], user: user, create_access: true) }
332
- let!(:collection) { create(:public_collection, title: ['Collection with Work'], user: user, create_access: true) }
331
+ let!(:empty_collection) { create(:public_collection_lw, title: ['Empty Collection'], user: user, with_permission_template: true) }
332
+ let!(:collection) { create(:public_collection_lw, title: ['Collection with Work'], user: user, with_permission_template: true) }
333
333
  let!(:admin_user) { create(:admin) }
334
334
  let!(:empty_adminset) { create(:admin_set, title: ['Empty Admin Set'], creator: [admin_user.user_key], with_permission_template: true) }
335
335
  let!(:adminset) { create(:admin_set, title: ['Admin Set with Work'], creator: [admin_user.user_key], with_permission_template: true) }
@@ -564,7 +564,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
564
564
 
565
565
  describe 'collection show page' do
566
566
  let(:collection) do
567
- create(:public_collection, user: user, description: ['collection description'], create_access: true)
567
+ build(:public_collection_lw, user: user, description: ['collection description'], with_permission_template: true)
568
568
  end
569
569
  let!(:work1) { create(:work, title: ["King Louie"], member_of_collections: [collection], user: user) }
570
570
  let!(:work2) { create(:work, title: ["King Kong"], member_of_collections: [collection], user: user) }
@@ -707,7 +707,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
707
707
 
708
708
  sign_in user
709
709
  end
710
- let(:collection) { create(:named_collection, user: user, create_access: true) }
710
+ let(:collection) { create(:named_collection_lw, user: user, with_permission_template: true) }
711
711
 
712
712
  it "shows a collection with a listing of Descriptive Metadata and catalog-style search results" do
713
713
  visit '/dashboard/my/collections'
@@ -762,7 +762,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
762
762
  end
763
763
 
764
764
  describe 'edit collection' do
765
- let(:collection) { create(:named_collection, user: user, create_access: true) }
765
+ let(:collection) { build(:named_collection_lw, user: user, with_permission_template: true) }
766
766
  let!(:work1) { create(:work, title: ["King Louie"], member_of_collections: [collection], user: user) }
767
767
  let!(:work2) { create(:work, title: ["King Kong"], member_of_collections: [collection], user: user) }
768
768
 
@@ -856,8 +856,8 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
856
856
  end
857
857
 
858
858
  context 'with brandable set' do
859
- let(:brandable_collection_id) { create(:collection, user: user, collection_type_settings: [:brandable], create_access: true).id }
860
- let(:not_brandable_collection_id) { create(:collection, user: user, collection_type_settings: [:not_brandable], create_access: true).id }
859
+ let(:brandable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:brandable], with_permission_template: true).id }
860
+ let(:not_brandable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:not_brandable], with_permission_template: true).id }
861
861
 
862
862
  it 'to true, it shows Branding tab' do
863
863
  visit "/dashboard/collections/#{brandable_collection_id}/edit"
@@ -871,8 +871,8 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
871
871
  end
872
872
 
873
873
  context 'with discoverable set' do
874
- let(:discoverable_collection_id) { create(:collection, user: user, collection_type_settings: [:discoverable], create_access: true).id }
875
- let(:not_discoverable_collection_id) { create(:collection, user: user, collection_type_settings: [:not_discoverable], create_access: true).id }
874
+ let(:discoverable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:discoverable], with_permission_template: true).id }
875
+ let(:not_discoverable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:not_discoverable], with_permission_template: true).id }
876
876
 
877
877
  it 'to true, it shows Discovery tab' do
878
878
  visit "/dashboard/collections/#{discoverable_collection_id}/edit"
@@ -886,8 +886,8 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
886
886
  end
887
887
 
888
888
  context 'with sharable set' do
889
- let(:sharable_collection_id) { create(:collection, user: user, collection_type_settings: [:sharable], create_access: true).id }
890
- let(:not_sharable_collection_id) { create(:collection, user: user, collection_type_settings: [:not_sharable], create_access: true).id }
889
+ let(:sharable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:sharable], with_permission_template: true).id }
890
+ let(:not_sharable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:not_sharable], with_permission_template: true).id }
891
891
 
892
892
  it 'to true, it shows Sharable tab' do
893
893
  visit "/dashboard/collections/#{sharable_collection_id}/edit"