curation_concerns 1.7.8 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -6
  3. data/CONTRIBUTING.md +20 -68
  4. data/app/actors/curation_concerns/actors/add_as_member_of_collections_actor.rb +23 -0
  5. data/app/actors/curation_concerns/actors/add_to_work_actor.rb +4 -16
  6. data/app/actors/curation_concerns/actors/apply_order_actor.rb +5 -16
  7. data/app/assets/javascripts/curation_concerns/file_manager/sorting.es6 +7 -17
  8. data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +6 -2
  9. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +2 -11
  10. data/app/controllers/concerns/curation_concerns/download_behavior.rb +0 -6
  11. data/app/forms/curation_concerns/forms/work_form.rb +10 -10
  12. data/app/indexers/curation_concerns/collection_indexer.rb +5 -0
  13. data/app/indexers/curation_concerns/work_indexer.rb +2 -0
  14. data/app/jobs/characterize_job.rb +5 -12
  15. data/app/jobs/create_derivatives_job.rb +5 -10
  16. data/app/jobs/ingest_file_job.rb +9 -13
  17. data/app/models/concerns/curation_concerns/ability.rb +0 -1
  18. data/app/models/concerns/curation_concerns/collection.rb +14 -0
  19. data/app/models/concerns/curation_concerns/required_metadata.rb +4 -0
  20. data/app/models/concerns/curation_concerns/solr_document_behavior.rb +4 -0
  21. data/app/models/concerns/curation_concerns/work_behavior.rb +0 -6
  22. data/app/presenters/curation_concerns/admin/workflow_role_presenter.rb +0 -4
  23. data/app/presenters/curation_concerns/collection_presenter.rb +4 -0
  24. data/app/presenters/curation_concerns/work_show_presenter.rb +52 -19
  25. data/app/search_builders/curation_concerns/collection_member_search_builder.rb +15 -1
  26. data/app/services/curation_concerns/actors/actor_factory.rb +1 -2
  27. data/app/services/curation_concerns/workflow/grant_edit_to_depositor.rb +1 -1
  28. data/app/services/curation_concerns/workflow/permission_query.rb +1 -4
  29. data/app/services/curation_concerns/workflow/workflow_factory.rb +1 -1
  30. data/app/services/curation_concerns/workflow/workflow_importer.rb +0 -1
  31. data/app/services/curation_concerns/workflow/workflow_schema.rb +0 -1
  32. data/app/views/catalog/_action_menu_partials/_default.html.erb +1 -7
  33. data/app/views/collections/_document_header.html.erb +0 -4
  34. data/app/views/collections/_edit_actions.html.erb +0 -1
  35. data/app/views/collections/_form.html.erb +1 -0
  36. data/app/views/collections/_show_actions.html.erb +1 -1
  37. data/app/views/collections/edit.html.erb +2 -2
  38. data/app/views/curation_concerns/admin/workflow_roles/index.html.erb +2 -1
  39. data/app/views/curation_concerns/base/_attributes.html.erb +3 -0
  40. data/app/views/curation_concerns/base/_file_manager_member_resource_options.html.erb +2 -2
  41. data/app/views/curation_concerns/base/_file_manager_members.html.erb +5 -13
  42. data/app/views/curation_concerns/base/_file_manager_resource_form.html.erb +1 -1
  43. data/app/views/curation_concerns/base/_form.html.erb +0 -5
  44. data/app/views/curation_concerns/base/_form_member_of_collections.html.erb +4 -0
  45. data/app/views/curation_concerns/base/_form_supplementary_fields.html.erb +1 -0
  46. data/app/views/curation_concerns/base/_member_of_collections.html.erb +10 -0
  47. data/app/views/curation_concerns/base/_show_actions.html.erb +0 -4
  48. data/app/views/curation_concerns/base/file_manager.html.erb +2 -2
  49. data/app/views/curation_concerns/base/show.json.jbuilder +1 -2
  50. data/config/locales/curation_concerns.en.yml +0 -4
  51. data/curation_concerns.gemspec +3 -2
  52. data/lib/curation_concerns/version.rb +1 -1
  53. data/lib/generators/curation_concerns/templates/catalog_controller.rb +1 -0
  54. data/spec/actors/curation_concerns/apply_order_actor_spec.rb +0 -20
  55. data/spec/actors/curation_concerns/work_actor_spec.rb +10 -14
  56. data/spec/controllers/curation_concerns/collections_controller_spec.rb +19 -14
  57. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +1 -2
  58. data/spec/controllers/downloads_controller_spec.rb +6 -5
  59. data/spec/features/collection_spec.rb +21 -6
  60. data/spec/features/create_child_work_spec.rb +2 -16
  61. data/spec/features/create_work_spec.rb +6 -13
  62. data/spec/features/work_generator_spec.rb +0 -9
  63. data/spec/forms/work_form_spec.rb +0 -8
  64. data/spec/indexers/collection_indexer_spec.rb +14 -0
  65. data/spec/models/collection_spec.rb +11 -48
  66. data/spec/models/curation_concerns/work_behavior_spec.rb +3 -3
  67. data/spec/models/file_set_spec.rb +3 -2
  68. data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +21 -27
  69. data/spec/services/curation_concerns/workflow/grant_edit_to_depositor_spec.rb +4 -15
  70. data/spec/services/curation_concerns/workflow/permission_query_spec.rb +1 -7
  71. data/spec/services/curation_concerns/workflow/workflow_importer_spec.rb +2 -5
  72. data/spec/services/curation_concerns/workflow/workflow_schema_spec.rb +0 -1
  73. data/spec/services/graph_exporter_spec.rb +3 -3
  74. data/spec/views/curation_concerns/base/_show_actions.html.erb_spec.rb +1 -1
  75. data/spec/views/curation_concerns/base/file_manager.html.erb_spec.rb +8 -10
  76. data/spec/views/curation_concerns/base/show.json.jbuilder_spec.rb +1 -3
  77. metadata +28 -32
  78. data/app/actors/curation_concerns/actors/add_to_collection_actor.rb +0 -42
  79. data/app/actors/curation_concerns/optimistic_lock_validator.rb +0 -28
  80. data/app/forms/curation_concerns/forms/file_manager_form.rb +0 -27
  81. data/app/presenters/curation_concerns/member_presenter_factory.rb +0 -70
  82. data/app/search_builders/curation_concerns/member_search_builder.rb +0 -21
  83. data/app/views/catalog/_action_menu_partials/_collection.html.erb +0 -27
  84. data/app/views/curation_concerns/base/_form_in_works_error.html.erb +0 -3
  85. data/app/views/curation_concerns/base/_form_ordered_members_error.html.erb +0 -3
  86. data/db/migrate/20170308175556_add_allows_access_grant_to_workflow.rb +0 -5
  87. data/spec/actors/curation_concerns/add_to_collections_actor_spec.rb +0 -66
  88. data/spec/actors/curation_concerns/optimistic_lock_validator_spec.rb +0 -50
  89. data/spec/forms/curation_concerns/forms/file_manager_form_spec.rb +0 -19
  90. data/spec/presenters/curation_concerns/member_presenter_factory_spec.rb +0 -25
  91. data/spec/views/curation_concerns/admin/workflow_roles/index.html.erb_spec.rb +0 -33
  92. data/spec/views/curation_concerns/base/_form.html.erb_spec.rb +0 -35
@@ -73,10 +73,15 @@ feature 'collection' do
73
73
 
74
74
  describe 'show collection' do
75
75
  let!(:collection) do
76
- create(:collection, user: user, description: ['collection description'], members: [gw1, gw2])
76
+ create(:collection, user: user, description: ['collection description'])
77
77
  end
78
78
 
79
79
  before do
80
+ [gw1, gw2].each do |gw|
81
+ gw.member_of_collections = [collection]
82
+ gw.save
83
+ end
84
+
80
85
  sign_in user
81
86
  visit search_path_for_my_collections
82
87
  end
@@ -120,9 +125,14 @@ feature 'collection' do
120
125
 
121
126
  describe 'edit collection' do
122
127
  let!(:collection) do
123
- create(:collection, user: user, description: ['collection description'], members: [gw1, gw2])
128
+ create(:collection, user: user, description: ['collection description'])
124
129
  end
125
130
  before do
131
+ [gw1, gw2].each do |gw|
132
+ gw.member_of_collections = [collection]
133
+ gw.save!
134
+ end
135
+
126
136
  sign_in user
127
137
  visit search_path_for_my_collections
128
138
  end
@@ -174,6 +184,8 @@ feature 'collection' do
174
184
  within("#document_#{gw1.id}") do
175
185
  click_link('Remove From Collection')
176
186
  end
187
+
188
+ visit collection_path collection.id
177
189
  expect(page).to have_content 'Test collection title'
178
190
  expect(page).to have_content 'collection description'
179
191
  expect(page).not_to have_content(gw1.title.first)
@@ -190,6 +202,8 @@ feature 'collection' do
190
202
  within("#document_#{gw1.id}") do
191
203
  click_link('Remove From Collection')
192
204
  end
205
+
206
+ visit collection_path collection.id
193
207
  expect(page).to have_content 'Test collection title'
194
208
  expect(page).to have_content 'collection description'
195
209
  expect(page).not_to have_content(gw1.title.first)
@@ -216,14 +230,15 @@ feature 'collection' do
216
230
  end
217
231
 
218
232
  describe 'show pages of a collection' do
219
- let(:generic_works) do
220
- (0..12).map { create(:generic_work, user: user) }
221
- end
222
233
  let!(:collection) do
223
- create(:collection, user: user, description: ['collection description'], members: generic_works)
234
+ create(:collection, user: user, description: ['collection description'])
224
235
  end
225
236
 
226
237
  before do
238
+ 12.times do
239
+ create(:generic_work, user: user, member_of_collections: [collection])
240
+ end
241
+
227
242
  sign_in user
228
243
  visit search_path_for_my_collections
229
244
  end
@@ -6,12 +6,12 @@ feature 'Creating a new child Work', :workflow do
6
6
  let!(:sipity_entity) do
7
7
  create(:sipity_entity, proxy_for_global_id: parent.to_global_id.to_s)
8
8
  end
9
- let(:redlock_client_stub) do # stub out redis connection
9
+ let(:redlock_client_stub) { # stub out redis connection
10
10
  client = double('redlock client')
11
11
  allow(client).to receive(:lock).and_yield(true)
12
12
  allow(Redlock::Client).to receive(:new).and_return(client)
13
13
  client
14
- end
14
+ }
15
15
  let!(:parent) { create(:generic_work, user: user, title: ["Parent First"]) }
16
16
 
17
17
  before do
@@ -64,19 +64,5 @@ feature 'Creating a new child Work', :workflow do
64
64
 
65
65
  expect(curation_concern.reload.in_works_ids.length).to eq 2
66
66
  end
67
-
68
- context "with a parent that doesn't belong to this user" do
69
- let(:new_user) { create(:user) }
70
- let(:new_parent) { create(:generic_work, user: new_user) }
71
- it "fails to update" do
72
- visit "/concern/parent/#{parent.id}/generic_works/#{curation_concern.id}/edit"
73
- first("input#generic_work_in_works_ids", visible: false).set new_parent.id
74
- first("input#parent_id", visible: false).set new_parent.id
75
- click_on "Update Generic work"
76
-
77
- expect(new_parent.reload.ordered_members.to_a.length).to eq 0
78
- expect(page).to have_content "Works can only be related to each other if user has ability to edit both."
79
- end
80
- end
81
67
  end
82
68
  end
@@ -12,6 +12,9 @@ feature 'Creating a new Work', :workflow do
12
12
  }
13
13
 
14
14
  before do
15
+ col = Collection.new title: ['Test Collection']
16
+ col.apply_depositor_metadata user.user_key
17
+ col.save!
15
18
  sign_in user
16
19
 
17
20
  # stub out characterization. Travis doesn't have fits installed, and it's not relevant to the test.
@@ -29,6 +32,7 @@ feature 'Creating a new Work', :workflow do
29
32
  select 'Attribution 3.0 United States', from: 'generic_work[rights][]'
30
33
  attach_file('Upload a file', fixture_file_path('files/image.png'))
31
34
  choose('generic_work_visibility_open')
35
+ select 'Test Collection', from: 'generic_work[member_of_collection_ids][]'
32
36
  click_on('Create Generic work')
33
37
  end
34
38
 
@@ -40,19 +44,8 @@ feature 'Creating a new Work', :workflow do
40
44
  expect(page).to have_link 'image.png'
41
45
  end
42
46
 
43
- title = 'Genealogies of the American West'
44
- click_link 'Add a Collection'
45
- fill_in('Title', with: title)
46
- click_button('Create Collection')
47
- click_on('Add files from your dashboard')
48
- find('#facet-human_readable_type_sim').click_link('Generic Work')
49
-
50
- # Works can be added to collections
51
- within('.modal.fade', match: :first) do
52
- select title, from: 'id'
53
- click_on('Add to collection')
47
+ within '.member_of_collections' do
48
+ expect(page).to have_link 'Test Collection'
54
49
  end
55
- expect(page).to have_content('Collection was successfully updated.')
56
- expect(page).to have_content(work_title)
57
50
  end
58
51
  end
@@ -53,14 +53,5 @@ feature 'Creating a new Work', :workflow do
53
53
  title = 'Genealogies of the American West'
54
54
  click_link 'Add a Collection'
55
55
  fill_in('Title', with: title)
56
- click_button('Create Collection')
57
- click_on('Add files from your dashboard')
58
- find('#facet-human_readable_type_sim').click_link('Catapult')
59
- within('.modal.fade', match: :first) do
60
- select title, from: 'id'
61
- click_on('Add to collection')
62
- end
63
- expect(page).to have_content('Collection was successfully updated.')
64
- expect(page).to have_content(catapult_title)
65
56
  end
66
57
  end
@@ -22,14 +22,6 @@ describe CurationConcerns::Forms::WorkForm do
22
22
  let(:ability) { nil }
23
23
  let(:form) { PirateShipForm.new(curation_concern, ability) }
24
24
 
25
- describe "#version" do
26
- before do
27
- allow(curation_concern).to receive(:etag).and_return('123456')
28
- end
29
- subject { form.version }
30
- it { is_expected.to eq '123456' }
31
- end
32
-
33
25
  describe "#select_files" do
34
26
  let(:curation_concern) { create(:work_with_one_file) }
35
27
  let(:title) { curation_concern.file_sets.first.title.first }
@@ -3,10 +3,22 @@ require 'spec_helper'
3
3
  describe CurationConcerns::CollectionIndexer do
4
4
  let(:indexer) { described_class.new(collection) }
5
5
  let(:collection) { build(:collection) }
6
+ let(:col1id) { 'col1' }
7
+ let(:col2id) { 'col2' }
8
+ let(:col1title) { 'col1 title' }
9
+ let(:col2title) { 'col2 title' }
10
+ let(:col1) { double('collection') }
11
+ let(:col2) { double('collection') }
6
12
 
7
13
  describe "#generate_solr_document" do
8
14
  before do
9
15
  allow(collection).to receive(:bytes).and_return(1000)
16
+ allow(collection).to receive(:in_collections).and_return([col1, col2])
17
+ allow(col1).to receive(:id).and_return(col1id)
18
+ allow(col2).to receive(:id).and_return(col2id)
19
+ allow(col1).to receive(:first_title).and_return(col1title)
20
+ allow(col2).to receive(:first_title).and_return(col2title)
21
+
10
22
  allow(CurationConcerns::ThumbnailPathService).to receive(:call).and_return("/downloads/1234?file=thumbnail")
11
23
  end
12
24
  subject { indexer.generate_solr_document }
@@ -15,6 +27,8 @@ describe CurationConcerns::CollectionIndexer do
15
27
  expect(subject.fetch('generic_type_sim')).to eq ["Collection"]
16
28
  expect(subject.fetch('bytes_lts')).to eq(1000)
17
29
  expect(subject.fetch('thumbnail_path_ss')).to eq "/downloads/1234?file=thumbnail"
30
+ expect(subject.fetch('member_of_collection_ids_ssim')).to eq [col1id, col2id]
31
+ expect(subject.fetch('member_of_collections_ssim')).to eq [col1title, col2title]
18
32
  end
19
33
  end
20
34
  end
@@ -55,55 +55,19 @@ describe Collection, type: :model do
55
55
  end
56
56
  end
57
57
 
58
- describe "#members" do
58
+ describe "#members_objects" do
59
+ before do
60
+ subject.save
61
+ end
59
62
  it "is empty by default" do
60
- expect(subject.members).to be_empty
63
+ expect(subject.member_objects).to match_array []
61
64
  end
62
65
 
63
66
  context "adding members" do
64
- context "using assignment" do
65
- subject { described_class.create!(title: ['Some title'], members: [gf1, gf2]) { |c| c.apply_depositor_metadata(user) } }
66
-
67
- it "has many files" do
68
- expect(subject.reload.members).to match_array [gf1, gf2]
69
- end
70
- end
71
-
72
- context "using append" do
73
- before do
74
- subject.members = [gf1]
75
- subject.save
76
- end
77
- it "allows new files to be added" do
78
- subject.reload
79
- subject.members << gf2
80
- subject.save
81
- expect(subject.reload.members).to match_array [gf1, gf2]
82
- end
83
-
84
- it "allows multiple files to be added" do
85
- subject.reload
86
- subject.add_members [gf2.id, gf3.id]
87
- subject.save
88
- expect(subject.reload.members).to match_array [gf1, gf2, gf3]
89
- end
90
- end
91
- end
92
-
93
- context "removing members" do
94
- before do
95
- subject.members = [gf1, gf2]
96
- subject.save!
97
- end
98
-
99
- it "allows files to be removed" do
100
- # force the "in_collections" to be cached:
101
- expect(gf1.in_collections).to eq [subject]
102
-
103
- # We need to ensure that deleting causes the collection to be flushed.
104
- subject.reload.members.delete(gf1)
67
+ it "allows multiple files to be added" do
68
+ subject.add_member_objects [gf1.id, gf2.id, gf3.id]
105
69
  subject.save
106
- expect(subject.reload.members).to eq [gf2]
70
+ expect(subject.reload.member_objects).to match_array [gf1, gf2, gf3]
107
71
  end
108
72
  end
109
73
  end
@@ -150,16 +114,15 @@ describe Collection, type: :model do
150
114
  end
151
115
 
152
116
  let(:member) { Member.create }
153
- let(:collection) { OtherCollection.new }
117
+ let(:collection) { OtherCollection.create }
154
118
 
155
119
  before do
156
- collection.members << member
157
- collection.save
120
+ collection.add_member_objects member.id
158
121
  end
159
122
 
160
123
  it "have members that know about the collection" do
161
124
  member.reload
162
- expect(member.in_collections).to eq [collection]
125
+ expect(member.member_of_collections).to eq [collection]
163
126
  end
164
127
  end
165
128
  end
@@ -19,9 +19,9 @@ describe CurationConcerns::WorkBehavior do
19
19
  end
20
20
  describe '#to_s' do
21
21
  it 'uses the provided titles' do
22
- # The title property would return the terms in random order, so stub the behavior:
23
- allow(subject).to receive(:title).and_return(%w(Hello World))
24
- expect(subject.to_s).to eq('Hello | World')
22
+ subject.title = %w(Hello World)
23
+ expect(subject.to_s).to include 'Hello'
24
+ expect(subject.to_s).to include 'World'
25
25
  end
26
26
  end
27
27
 
@@ -448,8 +448,9 @@ describe FileSet do
448
448
  describe '#to_s' do
449
449
  it 'uses the provided titles' do
450
450
  # The title property would return the terms in random order, so stub the behavior:
451
- allow(subject).to receive(:title).and_return(%w(Hello World))
452
- expect(subject.to_s).to eq('Hello | World')
451
+ subject.title = %w(Hello World)
452
+ expect(subject.to_s).to include 'Hello'
453
+ expect(subject.to_s).to include 'World'
453
454
  end
454
455
 
455
456
  it 'falls back on label if no titles are given' do
@@ -81,16 +81,6 @@ describe CurationConcerns::WorkShowPresenter do
81
81
  expect(presenter.file_set_presenters.map(&:id)).to eq obj.ordered_member_ids
82
82
  end
83
83
 
84
- context "solr query" do
85
- before do
86
- expect(ActiveFedora::SolrService).to receive(:query).twice.with(anything, hash_including(rows: 10_000)).and_return([])
87
- end
88
-
89
- it "requests >10 rows" do
90
- presenter.file_set_presenters
91
- end
92
- end
93
-
94
84
  context "when some of the members are not file sets" do
95
85
  let(:another_work) { create(:work) }
96
86
  before do
@@ -102,34 +92,38 @@ describe CurationConcerns::WorkShowPresenter do
102
92
  expect(presenter.file_set_presenters.map(&:id)).not_to include another_work.id
103
93
  end
104
94
  end
95
+
96
+ describe "getting presenters from factory" do
97
+ let(:attributes) { {} }
98
+ let(:presenter_class) { double }
99
+ before do
100
+ allow(presenter).to receive(:composite_presenter_class).and_return(presenter_class)
101
+ allow(presenter).to receive(:ordered_ids).and_return(['12', '33'])
102
+ allow(presenter).to receive(:file_set_ids).and_return(['33', '12'])
103
+ end
104
+
105
+ it "uses the set class" do
106
+ expect(CurationConcerns::PresenterFactory).to receive(:build_presenters)
107
+ .with(['12', '33'], presenter_class, ability, request)
108
+ presenter.file_set_presenters
109
+ end
110
+ end
105
111
  end
106
112
 
107
113
  describe "#representative_presenter" do
108
114
  let(:obj) { create(:work_with_representative_file) }
109
115
  let(:attributes) { obj.to_solr }
116
+ let(:presenter_class) { double }
117
+ before do
118
+ allow(presenter).to receive(:composite_presenter_class).and_return(presenter_class)
119
+ end
110
120
  it "has a representative" do
111
121
  expect(CurationConcerns::PresenterFactory).to receive(:build_presenters)
112
- .with([obj.members[0].id], CurationConcerns::CompositePresenterFactory, ability, request).and_return ["abc"]
122
+ .with([obj.members[0].id], presenter_class, ability, request).and_return ["abc"]
113
123
  expect(presenter.representative_presenter).to eq("abc")
114
124
  end
115
125
  end
116
126
 
117
- describe "#collection_presenters" do
118
- let(:collection) { create(:collection) }
119
- let(:obj) { create(:work) }
120
- let(:attributes) { obj.to_solr }
121
-
122
- before do
123
- collection.members << obj
124
- collection.save!
125
- obj.save!
126
- end
127
-
128
- it "filters out members that are not file sets" do
129
- expect(presenter.collection_presenters.map(&:id)).to eq [collection.id]
130
- end
131
- end
132
-
133
127
  describe '#page_title' do
134
128
  subject { presenter.page_title }
135
129
  it { is_expected.to eq 'foo' }
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe CurationConcerns::Workflow::GrantEditToDepositor do
4
4
  let(:depositor) { create(:user) }
5
+ let(:work) { create(:work_without_access, depositor: depositor.user_key) }
5
6
  let(:user) { User.new }
6
7
 
7
8
  describe ".call" do
@@ -11,21 +12,9 @@ RSpec.describe CurationConcerns::Workflow::GrantEditToDepositor do
11
12
  user: user)
12
13
  end
13
14
 
14
- context "with no additional editors" do
15
- let(:work) { create(:work_without_access, depositor: depositor.user_key) }
16
- it "adds edit access" do
17
- expect { subject }.to change { work.edit_users }.from([]).to([depositor.user_key])
18
- expect(work).to be_valid
19
- end
20
- end
21
-
22
- context "with an additional editor" do
23
- let(:editor) { create(:user) }
24
- let(:work) { create(:work_without_access, depositor: depositor.user_key, edit_users: [editor.user_key]) }
25
- it "adds edit access" do
26
- expect { subject }.to change { work.edit_users }.from([editor.user_key]).to([editor.user_key, depositor.user_key])
27
- expect(work).to be_valid
28
- end
15
+ it "adds edit access " do
16
+ expect { subject }.to change { work.edit_users }.from([]).to([depositor.user_key])
17
+ expect(work).to be_valid
29
18
  end
30
19
  end
31
20
  end
@@ -165,18 +165,12 @@ module CurationConcerns
165
165
  subject { described_class.scope_processing_agents_for(user: nil) }
166
166
  it { is_expected.to eq([]) }
167
167
  end
168
-
169
168
  context 'when user is persisted' do
170
169
  let(:user) { create(:user) }
171
- before do
172
- allow(user).to receive(:groups).and_return(['librarians'])
173
- end
174
-
175
170
  subject { described_class.scope_processing_agents_for(user: user) }
176
-
177
171
  it 'will equal [kind_of(Sipity::Agent)]' do
178
172
  is_expected.to contain_exactly(PowerConverter.convert_to_sipity_agent(user),
179
- PowerConverter.convert_to_sipity_agent(Group.new('librarians')))
173
+ PowerConverter.convert_to_sipity_agent(Group.new('registered')))
180
174
  end
181
175
  end
182
176
  end