hyrax 2.0.0.rc1 → 2.0.0.rc2
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 +4 -4
- data/README.md +2 -2
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +5 -1
- data/app/assets/stylesheets/hyrax/_header.scss +6 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +1 -1
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +4 -3
- data/app/controllers/hyrax/collections_controller.rb +2 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +113 -48
- data/app/jobs/ingest_local_file_job.rb +0 -1
- data/app/renderers/hyrax/renderers/rights_statement_attribute_renderer.rb +25 -0
- data/app/search_builders/hyrax/deposit_search_builder.rb +6 -3
- data/app/search_builders/hyrax/stats/work_status_search_builder.rb +4 -5
- data/app/services/hyrax/default_middleware_stack.rb +0 -1
- data/app/services/hyrax/file_set_derivatives_service.rb +13 -4
- data/app/services/hyrax/statistics/depositors/summary.rb +1 -1
- data/app/services/hyrax/workflow/abstract_notification.rb +3 -2
- data/app/services/hyrax/workflow/notification_service.rb +3 -12
- data/app/services/hyrax/workflow/permission_query.rb +3 -3
- data/app/services/hyrax/workflow/status_list_service.rb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +1 -0
- data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +1 -1
- data/app/views/hyrax/base/_attribute_rows.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +3 -0
- data/app/views/hyrax/dashboard/_index_partials/_proxy_rights.html.erb +1 -0
- data/app/views/hyrax/notifications/_notifications.html.erb +1 -0
- data/config/locales/hyrax.de.yml +7 -3
- data/config/locales/hyrax.en.yml +16 -12
- data/config/locales/hyrax.es.yml +4 -0
- data/config/locales/hyrax.fr.yml +4 -0
- data/config/locales/hyrax.it.yml +4 -0
- data/config/locales/hyrax.pt-BR.yml +4 -0
- data/config/locales/hyrax.zh.yml +4 -0
- data/hyrax.gemspec +2 -2
- data/lib/generators/hyrax/templates/config/locales/hyrax.de.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.es.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.fr.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.it.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.pt-BR.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.zh.yml +1 -1
- data/lib/hyrax/configuration.rb +11 -0
- data/lib/hyrax/version.rb +1 -1
- data/spec/abilities/file_set_abilities_spec.rb +3 -3
- data/spec/abilities/generic_work_abilities_spec.rb +5 -5
- data/spec/actors/hyrax/actors/generic_work_actor_spec.rb +12 -12
- data/spec/actors/hyrax/actors/transactional_request_spec.rb +1 -1
- data/spec/controllers/hyrax/api/items_controller_spec.rb +6 -6
- data/spec/controllers/hyrax/citations_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/collections_controller_spec.rb +1 -0
- data/spec/controllers/hyrax/content_blocks_controller_spec.rb +5 -5
- data/spec/controllers/hyrax/dashboard/profiles_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/downloads_controller_spec.rb +3 -3
- data/spec/controllers/hyrax/featured_work_lists_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/homepage_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/pages_controller_spec.rb +6 -6
- data/spec/controllers/hyrax/users_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/workflow_actions_controller_spec.rb +1 -1
- data/spec/conversions/power_converters/polymorphic_type_spec.rb +1 -1
- data/spec/factories/admin_sets.rb +1 -1
- data/spec/factories/api_items.rb +1 -1
- data/spec/factories/collections_factory.rb +2 -2
- data/spec/factories/content_blocks.rb +1 -1
- data/spec/factories/featured_works.rb +1 -1
- data/spec/factories/file_sets.rb +3 -3
- data/spec/factories/generic_works.rb +15 -15
- data/spec/factories/operations.rb +1 -1
- data/spec/factories/permission_template_accesses.rb +1 -1
- data/spec/factories/permission_templates.rb +1 -1
- data/spec/factories/proxy_deposit_requests.rb +2 -2
- data/spec/factories/single_use_links.rb +1 -1
- data/spec/factories/sipity_entities.rb +1 -1
- data/spec/factories/uploaded_files.rb +1 -1
- data/spec/factories/users.rb +2 -2
- data/spec/factories/workflow_actions.rb +1 -1
- data/spec/factories/workflow_states.rb +1 -1
- data/spec/factories/workflows.rb +1 -1
- data/spec/features/notifications_spec.rb +1 -1
- data/spec/forms/hyrax/forms/permission_template_form_spec.rb +113 -2
- data/spec/helpers/hyrax/collections_helper_spec.rb +2 -2
- data/spec/helpers/hyrax/content_block_helper_spec.rb +1 -1
- data/spec/helpers/hyrax/trophy_helper_spec.rb +1 -1
- data/spec/jobs/create_derivatives_job_spec.rb +3 -4
- data/spec/jobs/ingest_local_file_job_spec.rb +2 -5
- data/spec/lib/hyrax/arkivo/actor_spec.rb +2 -2
- data/spec/lib/hyrax/arkivo/metadata_munger_spec.rb +1 -1
- data/spec/lib/hyrax/arkivo/schema_validator_spec.rb +1 -1
- data/spec/lib/hyrax/configuration_spec.rb +4 -0
- data/spec/models/file_set_spec.rb +1 -1
- data/spec/models/generic_work_spec.rb +1 -1
- data/spec/models/hyrax/user_usage_stats_spec.rb +1 -1
- data/spec/models/sipity/entity_spec.rb +1 -1
- data/spec/models/user_spec.rb +7 -7
- data/spec/presenters/hyrax/admin/users_presenter_spec.rb +2 -2
- data/spec/renderers/hyrax/renderers/rights_statement_attribute_renderer_spec.rb +20 -0
- data/spec/search_builders/hyrax/stats/work_status_search_builder_spec.rb +12 -12
- data/spec/services/hyrax/default_middleware_stack_spec.rb +0 -1
- data/spec/services/hyrax/embargo_service_spec.rb +4 -4
- data/spec/services/hyrax/workflow/notification_service_spec.rb +0 -35
- data/spec/services/hyrax/workflow/permission_generator_spec.rb +1 -1
- data/spec/services/hyrax/workflow/status_list_service_spec.rb +12 -0
- data/spec/spec_helper.rb +6 -6
- data/spec/support/features/session_helpers.rb +1 -1
- data/spec/views/hyrax/admin/users/index.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_attribute_rows.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/file_manager.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/collections/show.html.erb_spec.rb +23 -5
- data/spec/views/pages/show.html.erb_spec.rb +1 -1
- data/template.rb +1 -1
- metadata +8 -6
- data/app/actors/hyrax/actors/assign_representative_actor.rb +0 -22
data/hyrax.gemspec
CHANGED
|
@@ -87,7 +87,7 @@ EOF
|
|
|
87
87
|
spec.add_development_dependency 'capybara-maleficent', '~> 0.2'
|
|
88
88
|
spec.add_development_dependency "chromedriver-helper"
|
|
89
89
|
spec.add_development_dependency "selenium-webdriver"
|
|
90
|
-
spec.add_development_dependency "
|
|
90
|
+
spec.add_development_dependency "factory_bot_rails", '~> 4.4'
|
|
91
91
|
spec.add_development_dependency "equivalent-xml", '~> 0.5'
|
|
92
92
|
spec.add_development_dependency "jasmine", '~> 2.3'
|
|
93
93
|
# Pin rubocop and rubocop-rspec tightly. Minor-level version bumps
|
|
@@ -103,7 +103,7 @@ EOF
|
|
|
103
103
|
spec.add_development_dependency 'rubocop', '~> 0.49.1'
|
|
104
104
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.16.0'
|
|
105
105
|
spec.add_development_dependency 'shoulda-matchers', '~> 3.1'
|
|
106
|
-
spec.add_development_dependency 'rails-controller-testing', '~>
|
|
106
|
+
spec.add_development_dependency 'rails-controller-testing', '~> 1'
|
|
107
107
|
spec.add_development_dependency 'webmock'
|
|
108
108
|
spec.add_development_dependency 'i18n-debug' if ENV['I18N_DEBUG']
|
|
109
109
|
spec.add_development_dependency 'i18n_yaml_sorter' unless ENV['TRAVIS']
|
data/lib/hyrax/configuration.rb
CHANGED
|
@@ -228,6 +228,17 @@ module Hyrax
|
|
|
228
228
|
@license_service_class ||= Hyrax::LicenseService
|
|
229
229
|
end
|
|
230
230
|
|
|
231
|
+
# A configuration point for changing the behavior of the rights statement service.
|
|
232
|
+
#
|
|
233
|
+
# @!attribute [w] license_service_class
|
|
234
|
+
# A configuration point for changing the behavior of the license service.
|
|
235
|
+
#
|
|
236
|
+
# @see Hyrax::RightsStatementService for implementation details
|
|
237
|
+
attr_writer :rights_statement_service_class
|
|
238
|
+
def rights_statement_service_class
|
|
239
|
+
@rights_statement_service_class ||= Hyrax::RightsStatementService
|
|
240
|
+
end
|
|
241
|
+
|
|
231
242
|
attr_writer :banner_image
|
|
232
243
|
def banner_image
|
|
233
244
|
# This image can be used for free and without attribution. See here for source and license: https://github.com/samvera/hyrax/issues/1551#issuecomment-326624909
|
data/lib/hyrax/version.rb
CHANGED
|
@@ -27,7 +27,7 @@ RSpec.describe 'User' do
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
describe 'as a repository manager' do
|
|
30
|
-
let(:manager_user) {
|
|
30
|
+
let(:manager_user) { FactoryBot.create(:admin) }
|
|
31
31
|
let(:creating_user) { user }
|
|
32
32
|
let(:current_user) { manager_user }
|
|
33
33
|
|
|
@@ -41,7 +41,7 @@ RSpec.describe 'User' do
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
describe 'another authenticated user' do
|
|
44
|
-
let(:creating_user) {
|
|
44
|
+
let(:creating_user) { FactoryBot.create(:user) }
|
|
45
45
|
let(:current_user) { user }
|
|
46
46
|
|
|
47
47
|
it do
|
|
@@ -54,7 +54,7 @@ RSpec.describe 'User' do
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
describe 'a nil user' do
|
|
57
|
-
let(:creating_user) {
|
|
57
|
+
let(:creating_user) { FactoryBot.create(:user) }
|
|
58
58
|
let(:current_user) { nil }
|
|
59
59
|
|
|
60
60
|
it do
|
|
@@ -4,8 +4,8 @@ RSpec.describe 'User' do
|
|
|
4
4
|
describe 'Abilities' do
|
|
5
5
|
subject { Ability.new(current_user) }
|
|
6
6
|
|
|
7
|
-
let(:generic_work) {
|
|
8
|
-
let(:user) {
|
|
7
|
+
let(:generic_work) { FactoryBot.create(:private_generic_work, user: creating_user) }
|
|
8
|
+
let(:user) { FactoryBot.create(:user) }
|
|
9
9
|
|
|
10
10
|
describe 'without embargo' do
|
|
11
11
|
describe 'creator of object' do
|
|
@@ -21,7 +21,7 @@ RSpec.describe 'User' do
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
describe 'as a repository manager' do
|
|
24
|
-
let(:manager_user) {
|
|
24
|
+
let(:manager_user) { FactoryBot.create(:admin) }
|
|
25
25
|
let(:creating_user) { user }
|
|
26
26
|
let(:current_user) { manager_user }
|
|
27
27
|
|
|
@@ -34,7 +34,7 @@ RSpec.describe 'User' do
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'another authenticated user' do
|
|
37
|
-
let(:creating_user) {
|
|
37
|
+
let(:creating_user) { FactoryBot.create(:user) }
|
|
38
38
|
let(:current_user) { user }
|
|
39
39
|
|
|
40
40
|
it do
|
|
@@ -47,7 +47,7 @@ RSpec.describe 'User' do
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
describe 'a nil user' do
|
|
50
|
-
let(:creating_user) {
|
|
50
|
+
let(:creating_user) { FactoryBot.create(:user) }
|
|
51
51
|
let(:current_user) { nil }
|
|
52
52
|
|
|
53
53
|
it do
|
|
@@ -101,7 +101,7 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
101
101
|
context 'with in_work_ids' do
|
|
102
102
|
let(:parent) { create(:generic_work, user: user) }
|
|
103
103
|
let(:attributes) do
|
|
104
|
-
|
|
104
|
+
FactoryBot.attributes_for(:generic_work, visibility: visibility, admin_set_id: admin_set.id).merge(
|
|
105
105
|
in_works_ids: [parent.id]
|
|
106
106
|
)
|
|
107
107
|
end
|
|
@@ -120,7 +120,7 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
120
120
|
|
|
121
121
|
context 'with a file' do
|
|
122
122
|
let(:attributes) do
|
|
123
|
-
|
|
123
|
+
FactoryBot.attributes_for(:generic_work, admin_set_id: admin_set.id, visibility: visibility).tap do |a|
|
|
124
124
|
a[:uploaded_files] = [uploaded_file.id]
|
|
125
125
|
end
|
|
126
126
|
end
|
|
@@ -158,7 +158,7 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
158
158
|
let(:file_actor) { double }
|
|
159
159
|
let(:uploaded_file2) { Hyrax::UploadedFile.create(file: file, user: user) }
|
|
160
160
|
let(:attributes) do
|
|
161
|
-
|
|
161
|
+
FactoryBot.attributes_for(:generic_work, admin_set_id: admin_set.id, visibility: visibility).tap do |a|
|
|
162
162
|
a[:uploaded_files] = [uploaded_file.id, uploaded_file2.id]
|
|
163
163
|
end
|
|
164
164
|
end
|
|
@@ -189,7 +189,7 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
189
189
|
|
|
190
190
|
context 'with a present and a blank title' do
|
|
191
191
|
let(:attributes) do
|
|
192
|
-
|
|
192
|
+
FactoryBot.attributes_for(:generic_work, admin_set_id: admin_set.id, title: ['this is present', ''])
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
it 'stamps each link with the access rights' do
|
|
@@ -227,7 +227,7 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
227
227
|
let(:parent) { create(:generic_work, user: user) }
|
|
228
228
|
let(:old_parent) { create(:generic_work, user: user) }
|
|
229
229
|
let(:attributes) do
|
|
230
|
-
|
|
230
|
+
FactoryBot.attributes_for(:generic_work).merge(
|
|
231
231
|
in_works_ids: [parent.id]
|
|
232
232
|
)
|
|
233
233
|
end
|
|
@@ -244,9 +244,9 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
244
244
|
end
|
|
245
245
|
|
|
246
246
|
context 'without in_works_ids' do
|
|
247
|
-
let(:old_parent) {
|
|
247
|
+
let(:old_parent) { FactoryBot.create(:generic_work) }
|
|
248
248
|
let(:attributes) do
|
|
249
|
-
|
|
249
|
+
FactoryBot.attributes_for(:generic_work).merge(
|
|
250
250
|
in_works_ids: []
|
|
251
251
|
)
|
|
252
252
|
end
|
|
@@ -266,9 +266,9 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
266
266
|
end
|
|
267
267
|
|
|
268
268
|
context 'with nil in_works_ids' do
|
|
269
|
-
let(:parent) {
|
|
269
|
+
let(:parent) { FactoryBot.create(:generic_work) }
|
|
270
270
|
let(:attributes) do
|
|
271
|
-
|
|
271
|
+
FactoryBot.attributes_for(:generic_work).merge(
|
|
272
272
|
in_works_ids: nil
|
|
273
273
|
)
|
|
274
274
|
end
|
|
@@ -289,7 +289,7 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
289
289
|
let!(:collection1) { create(:collection, user: user) }
|
|
290
290
|
let!(:collection2) { create(:collection, user: user) }
|
|
291
291
|
let(:attributes) do
|
|
292
|
-
|
|
292
|
+
FactoryBot.attributes_for(:generic_work, member_of_collection_ids: [collection2.id])
|
|
293
293
|
end
|
|
294
294
|
|
|
295
295
|
before do
|
|
@@ -318,7 +318,7 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
318
318
|
let(:file_set2) { create(:file_set) }
|
|
319
319
|
let(:curation_concern) { create(:generic_work, user: user, ordered_members: [file_set1, file_set2], admin_set_id: admin_set.id) }
|
|
320
320
|
let(:attributes) do
|
|
321
|
-
|
|
321
|
+
FactoryBot.attributes_for(:generic_work, ordered_member_ids: [file_set2.id, file_set1.id])
|
|
322
322
|
end
|
|
323
323
|
|
|
324
324
|
it 'updates the order of file sets' do
|
|
@@ -331,7 +331,7 @@ RSpec.describe Hyrax::Actors::GenericWorkActor do
|
|
|
331
331
|
## Is this something we want to support?
|
|
332
332
|
context "when told to stop ordering a file set" do
|
|
333
333
|
let(:attributes) do
|
|
334
|
-
|
|
334
|
+
FactoryBot.attributes_for(:generic_work, ordered_member_ids: [file_set2.id])
|
|
335
335
|
end
|
|
336
336
|
|
|
337
337
|
it "works" do
|
|
@@ -19,7 +19,7 @@ RSpec.describe Hyrax::API::ItemsController, type: :controller do
|
|
|
19
19
|
|
|
20
20
|
context 'with an HTTP GET or HEAD' do
|
|
21
21
|
let(:token) { user.arkivo_token }
|
|
22
|
-
let(:item) {
|
|
22
|
+
let(:item) { FactoryBot.json(:post_item, token: token) }
|
|
23
23
|
let(:item_hash) { JSON.parse(item) }
|
|
24
24
|
|
|
25
25
|
context 'with a missing token' do
|
|
@@ -115,7 +115,7 @@ RSpec.describe Hyrax::API::ItemsController, type: :controller do
|
|
|
115
115
|
let(:deposited_file) { FileSet.where(label: item_hash['file']['filename']).take }
|
|
116
116
|
let(:a_work) { build :generic_work, id: '123' }
|
|
117
117
|
let!(:token) { user.arkivo_token }
|
|
118
|
-
let(:item) {
|
|
118
|
+
let(:item) { FactoryBot.json(:post_item, token: token) }
|
|
119
119
|
let(:item_hash) { JSON.parse(item) }
|
|
120
120
|
|
|
121
121
|
before do
|
|
@@ -159,7 +159,7 @@ RSpec.describe Hyrax::API::ItemsController, type: :controller do
|
|
|
159
159
|
before { post :create, body: item, params: { format: :json } }
|
|
160
160
|
|
|
161
161
|
let(:token) { 'unfamiliar_token' }
|
|
162
|
-
let(:item) {
|
|
162
|
+
let(:item) { FactoryBot.json(:post_item, token: token) }
|
|
163
163
|
|
|
164
164
|
it "is unathorized" do
|
|
165
165
|
expect(response).not_to be_success
|
|
@@ -170,7 +170,7 @@ RSpec.describe Hyrax::API::ItemsController, type: :controller do
|
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
context 'with an HTTP PUT' do
|
|
173
|
-
let(:put_item) {
|
|
173
|
+
let(:put_item) { FactoryBot.json(:put_item, token: token) }
|
|
174
174
|
let(:token) { user.arkivo_token }
|
|
175
175
|
let(:gw) { build :generic_work, id: '123' }
|
|
176
176
|
let(:relation) { double }
|
|
@@ -265,7 +265,7 @@ RSpec.describe Hyrax::API::ItemsController, type: :controller do
|
|
|
265
265
|
|
|
266
266
|
context 'with a valid item and unfamiliar token' do
|
|
267
267
|
let(:bad_token) { 'unfamiliar_token' }
|
|
268
|
-
let(:bad_token_item) {
|
|
268
|
+
let(:bad_token_item) { FactoryBot.json(:put_item, token: bad_token) }
|
|
269
269
|
|
|
270
270
|
before do
|
|
271
271
|
request.env['RAW_POST_DATA'] = bad_token_item
|
|
@@ -296,7 +296,7 @@ RSpec.describe Hyrax::API::ItemsController, type: :controller do
|
|
|
296
296
|
|
|
297
297
|
context 'with an HTTP DELETE' do
|
|
298
298
|
let(:token) { user.arkivo_token }
|
|
299
|
-
let(:item) {
|
|
299
|
+
let(:item) { FactoryBot.json(:post_item, token: token) }
|
|
300
300
|
let(:item_hash) { JSON.parse(item) }
|
|
301
301
|
let(:gw) { build :generic_work, id: '123' }
|
|
302
302
|
let(:relation) { double }
|
|
@@ -14,7 +14,7 @@ RSpec.describe Hyrax::CitationsController do
|
|
|
14
14
|
expect(controller).to receive(:add_breadcrumb).with('My Dashboard', Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
|
15
15
|
get :work, params: { id: work }
|
|
16
16
|
expect(response).to be_successful
|
|
17
|
-
expect(response).to render_template('layouts/hyrax')
|
|
17
|
+
expect(response).to render_template('layouts/hyrax/1_column')
|
|
18
18
|
expect(assigns(:presenter)).to be_kind_of Hyrax::WorkShowPresenter
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -42,7 +42,7 @@ RSpec.describe Hyrax::CitationsController do
|
|
|
42
42
|
expect(controller).to receive(:add_breadcrumb).with('My Dashboard', Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
|
43
43
|
get :file, params: { id: file_set }
|
|
44
44
|
expect(response).to be_successful
|
|
45
|
-
expect(response).to render_template('layouts/hyrax')
|
|
45
|
+
expect(response).to render_template('layouts/hyrax/1_column')
|
|
46
46
|
expect(assigns(:presenter)).to be_kind_of Hyrax::FileSetPresenter
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -32,6 +32,7 @@ RSpec.describe Hyrax::CollectionsController do
|
|
|
32
32
|
expect(controller).to receive(:add_breadcrumb).with(I18n.t('hyrax.dashboard.title'), Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
|
33
33
|
get :show, params: { id: collection }
|
|
34
34
|
expect(response).to be_successful
|
|
35
|
+
expect(response).to render_template("layouts/hyrax/1_column")
|
|
35
36
|
expect(assigns[:presenter]).to be_kind_of Hyrax::CollectionPresenter
|
|
36
37
|
expect(assigns[:presenter].title).to match_array collection.title
|
|
37
38
|
expect(assigns[:member_docs].map(&:id)).to match_array [asset1, asset2, asset3].map(&:id)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
RSpec.describe Hyrax::ContentBlocksController, type: :controller do
|
|
2
2
|
let!(:announcement_text) do
|
|
3
|
-
|
|
3
|
+
FactoryBot.create(:content_block, name: 'announcement_text')
|
|
4
4
|
end
|
|
5
5
|
let!(:marketing_text) do
|
|
6
|
-
|
|
6
|
+
FactoryBot.create(:content_block, name: 'marketing_text')
|
|
7
7
|
end
|
|
8
8
|
let!(:featured_researcher) do
|
|
9
|
-
|
|
9
|
+
FactoryBot.create(:content_block, name: 'featured_researcher')
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
before do
|
|
@@ -14,7 +14,7 @@ RSpec.describe Hyrax::ContentBlocksController, type: :controller do
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
context 'with an unprivileged user' do
|
|
17
|
-
let(:user) {
|
|
17
|
+
let(:user) { FactoryBot.create(:user) }
|
|
18
18
|
|
|
19
19
|
describe "GET #edit" do
|
|
20
20
|
it "denies the request" do
|
|
@@ -32,7 +32,7 @@ RSpec.describe Hyrax::ContentBlocksController, type: :controller do
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
context 'with an administrator' do
|
|
35
|
-
let(:user) {
|
|
35
|
+
let(:user) { FactoryBot.create(:admin) }
|
|
36
36
|
|
|
37
37
|
describe "GET #edit" do
|
|
38
38
|
it "renders breadcrumbs" do
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
RSpec.describe Hyrax::Dashboard::ProfilesController do
|
|
2
|
-
let(:user) {
|
|
2
|
+
let(:user) { FactoryBot.create(:user) }
|
|
3
3
|
|
|
4
4
|
before do
|
|
5
5
|
sign_in user
|
|
@@ -71,7 +71,7 @@ RSpec.describe Hyrax::Dashboard::ProfilesController do
|
|
|
71
71
|
|
|
72
72
|
describe "#update" do
|
|
73
73
|
context "the profile of another user" do
|
|
74
|
-
let(:another_user) {
|
|
74
|
+
let(:another_user) { FactoryBot.create(:user) }
|
|
75
75
|
|
|
76
76
|
it "does not allow other users to update" do
|
|
77
77
|
post :update, params: { id: another_user.user_key, user: { avatar: nil } }
|
|
@@ -2,9 +2,9 @@ RSpec.describe Hyrax::DownloadsController do
|
|
|
2
2
|
routes { Hyrax::Engine.routes }
|
|
3
3
|
|
|
4
4
|
describe '#show' do
|
|
5
|
-
let(:user) {
|
|
5
|
+
let(:user) { FactoryBot.create(:user) }
|
|
6
6
|
let(:file_set) do
|
|
7
|
-
|
|
7
|
+
FactoryBot.create(:file_with_work, user: user, content: File.open(fixture_path + '/image.png'))
|
|
8
8
|
end
|
|
9
9
|
let(:default_image) { ActionController::Base.helpers.image_path 'default.png' }
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ RSpec.describe Hyrax::DownloadsController do
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
context "when user doesn't have access" do
|
|
18
|
-
let(:another_user) {
|
|
18
|
+
let(:another_user) { FactoryBot.create(:user) }
|
|
19
19
|
|
|
20
20
|
before { sign_in another_user }
|
|
21
21
|
|
|
@@ -4,8 +4,8 @@ RSpec.describe Hyrax::FeaturedWorkListsController, type: :controller do
|
|
|
4
4
|
expect(controller).to receive(:authorize!).with(:update, FeaturedWork)
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
let(:feature1) {
|
|
8
|
-
let(:feature2) {
|
|
7
|
+
let(:feature1) { FactoryBot.create(:featured_work) }
|
|
8
|
+
let(:feature2) { FactoryBot.create(:featured_work) }
|
|
9
9
|
|
|
10
10
|
it "is successful" do
|
|
11
11
|
post :create, params: {
|