hyrax 2.0.0.beta4 → 2.0.0.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_fixme.yml +0 -1
- data/.travis.yml +4 -3
- data/README.md +3 -3
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +22 -0
- data/app/actors/hyrax/actors/file_set_actor.rb +4 -0
- data/app/actors/hyrax/actors/transfer_request_actor.rb +23 -0
- data/app/assets/javascripts/hyrax/autocomplete/default.es6 +2 -1
- data/app/assets/stylesheets/hyrax/_file_manager.scss +3 -0
- data/app/controllers/hyrax/dashboard/collections_controller.rb +0 -1
- data/app/controllers/hyrax/my_controller.rb +1 -1
- data/app/forms/hyrax/forms/work_form.rb +5 -4
- data/app/helpers/hyrax/content_block_helper_behavior.rb +2 -2
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +0 -7
- data/app/indexers/hyrax/indexes_workflow.rb +1 -1
- data/app/models/admin_set.rb +1 -1
- data/app/models/concerns/hyrax/basic_metadata.rb +1 -1
- data/app/models/concerns/hyrax/in_admin_set.rb +1 -1
- data/app/models/concerns/hyrax/proxy_deposit.rb +0 -8
- data/app/models/concerns/hyrax/solr_document_behavior.rb +0 -11
- data/app/models/concerns/hyrax/user.rb +3 -3
- data/app/models/hyrax/orcid_validator.rb +6 -1
- data/app/services/hyrax/admin_set_create_service.rb +0 -1
- data/app/services/hyrax/default_middleware_stack.rb +1 -0
- data/app/services/hyrax/statistics/depositors/summary.rb +5 -1
- data/app/services/hyrax/statistics/over_time.rb +5 -1
- data/app/services/hyrax/statistics/query_service.rb +55 -0
- data/app/services/hyrax/statistics/works/count.rb +1 -1
- data/app/services/hyrax/workflow/status_list_service.rb +1 -1
- data/app/views/hyrax/base/_form.html.erb +2 -1
- data/app/views/hyrax/base/_form_files.html.erb +0 -2
- data/app/views/hyrax/base/_form_progress.html.erb +1 -1
- data/app/views/hyrax/base/_form_visibility_error.html.erb +3 -0
- data/app/views/hyrax/base/_show_actions.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_actions.html.erb +1 -1
- data/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb +4 -1
- data/app/views/hyrax/dashboard/show_user.html.erb +3 -1
- data/app/views/hyrax/file_sets/_show_actions.html.erb +1 -1
- data/app/views/hyrax/homepage/_recent_document.html.erb +1 -1
- data/config/locales/hyrax.de.yml +9 -8
- data/hyrax.gemspec +2 -2
- data/lib/generators/hyrax/config_generator.rb +14 -16
- data/lib/generators/hyrax/templates/config/{hyrax.rb → initializers/hyrax.rb} +21 -0
- data/lib/generators/hyrax/templates/config/{mini_magick.rb → initializers/mini_magick.rb} +0 -0
- data/lib/generators/hyrax/templates/config/{redis_config.rb → initializers/redis_config.rb} +0 -0
- data/lib/hyrax.rb +2 -1
- data/lib/hyrax/configuration.rb +17 -10
- data/lib/hyrax/controlled_vocabularies.rb +9 -0
- data/{app/controlled_vocabularies → lib}/hyrax/controlled_vocabularies/location.rb +0 -0
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/create_with_remote_files_actor_spec.rb +36 -0
- data/spec/actors/hyrax/actors/file_set_actor_spec.rb +5 -1
- data/spec/actors/hyrax/actors/transfer_request_actor_spec.rb +43 -0
- data/spec/controllers/hyrax/admin/admin_sets_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/api/items_controller_spec.rb +4 -4
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +3 -6
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +87 -68
- data/spec/controllers/hyrax/dashboard/profiles_controller_spec.rb +5 -5
- data/spec/controllers/hyrax/file_sets_controller_spec.rb +7 -19
- data/spec/controllers/hyrax/fixity_checks_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +1 -3
- data/spec/controllers/hyrax/single_use_links_viewer_controller_spec.rb +2 -4
- data/spec/factories/admin_sets.rb +0 -4
- data/spec/forms/hyrax/forms/work_form_spec.rb +41 -0
- data/spec/helpers/hyrax/content_block_helper_spec.rb +6 -0
- data/spec/helpers/hyrax_helper_spec.rb +0 -13
- data/spec/indexers/hyrax/generic_work_indexer_spec.rb +4 -1
- data/spec/javascripts/autocomplete_spec.js.coffee +39 -4
- data/spec/jobs/fixity_check_job_spec.rb +1 -2
- data/spec/lib/hyrax/configuration_spec.rb +4 -2
- data/spec/models/admin_set_spec.rb +0 -24
- data/spec/models/collection_spec.rb +0 -13
- data/spec/models/file_set_spec.rb +0 -17
- data/spec/models/generic_work_spec.rb +0 -11
- data/spec/models/solr_document_spec.rb +0 -32
- data/spec/models/user_spec.rb +20 -5
- data/spec/presenters/hyrax/file_usage_spec.rb +3 -7
- data/spec/services/hyrax/admin_set_create_service_spec.rb +2 -2
- data/spec/services/hyrax/admin_set_service_spec.rb +2 -2
- data/spec/services/hyrax/change_content_depositor_service_spec.rb +2 -6
- data/spec/services/hyrax/collections_service_spec.rb +1 -1
- data/spec/services/hyrax/default_middleware_stack_spec.rb +1 -0
- data/spec/services/hyrax/import_url_failure_service_spec.rb +1 -3
- data/spec/services/hyrax/persist_directly_contained_output_file_service_spec.rb +2 -1
- data/spec/services/hyrax/repository_fixity_check_service_spec.rb +1 -3
- data/spec/services/hyrax/{query_service_spec.rb → statistics/query_service_spec.rb} +5 -3
- data/spec/services/hyrax/versioning_service_spec.rb +2 -5
- data/spec/services/hyrax/work_query_service_spec.rb +1 -1
- data/spec/services/hyrax/workflow/status_list_service_spec.rb +7 -2
- data/spec/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb_spec.rb +1 -4
- data/spec/views/hyrax/base/_form.html.erb_spec.rb +4 -11
- data/spec/views/hyrax/base/_form_progress.html.erb_spec.rb +14 -0
- data/spec/views/hyrax/collections/_show_document_list_row.html.erb_spec.rb +1 -3
- data/spec/views/hyrax/dashboard/collections/_show_document_list_row.html.erb_spec.rb +1 -3
- data/spec/views/hyrax/dashboard/profiles/edit.html.erb_spec.rb +24 -0
- data/spec/views/hyrax/dashboard/show_user_spec.rb +24 -0
- data/template.rb +1 -1
- metadata +18 -13
- data/app/services/hyrax/query_service.rb +0 -53
@@ -136,10 +136,14 @@ RSpec.describe Hyrax::Actors::FileSetActor do
|
|
136
136
|
describe '#create_content when from_url is true' do
|
137
137
|
before do
|
138
138
|
expect(JobIoWrapper).to receive(:create_with_varied_file_handling!).with(any_args).once.and_call_original
|
139
|
+
allow(VisibilityCopyJob).to receive(:perform_later).with(file_set.parent).and_return(true)
|
140
|
+
allow(InheritPermissionsJob).to receive(:perform_later).with(file_set.parent).and_return(true)
|
139
141
|
end
|
140
142
|
|
141
|
-
it 'calls ingest_file' do
|
143
|
+
it 'calls ingest_file and kicks off jobs' do
|
142
144
|
actor.create_content(file, from_url: true)
|
145
|
+
expect(VisibilityCopyJob).to have_received(:perform_later)
|
146
|
+
expect(InheritPermissionsJob).to have_received(:perform_later)
|
143
147
|
end
|
144
148
|
|
145
149
|
context 'when an alternative relationship is specified' do
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe Hyrax::Actors::TransferRequestActor do
|
4
|
+
let(:ability) { ::Ability.new(depositor) }
|
5
|
+
let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) }
|
6
|
+
let(:terminator) { Hyrax::Actors::Terminator.new }
|
7
|
+
let(:depositor) { create(:user) }
|
8
|
+
let(:work) do
|
9
|
+
build(:generic_work, on_behalf_of: proxied_to)
|
10
|
+
end
|
11
|
+
let(:attributes) { {} }
|
12
|
+
|
13
|
+
subject(:middleware) do
|
14
|
+
stack = ActionDispatch::MiddlewareStack.new.tap do |middleware|
|
15
|
+
middleware.use described_class
|
16
|
+
end
|
17
|
+
stack.build(terminator)
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "create" do
|
21
|
+
context "when on_behalf_of is blank" do
|
22
|
+
let(:proxied_to) { '' }
|
23
|
+
|
24
|
+
it "returns true" do
|
25
|
+
expect(middleware.create(env)).to be true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when proxied_to is provided" do
|
30
|
+
let(:proxied_to) { 'james@example.com' }
|
31
|
+
|
32
|
+
before do
|
33
|
+
create(:user, email: proxied_to)
|
34
|
+
allow(terminator).to receive(:create).and_return(true)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "adds the template users to the work" do
|
38
|
+
expect(ContentDepositorChangeEventJob).to receive(:perform_later).with(work, User)
|
39
|
+
expect(middleware.create(env)).to be true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -21,7 +21,7 @@ RSpec.describe Hyrax::Admin::AdminSetsController do
|
|
21
21
|
context "a public admin set" do
|
22
22
|
# Even though the user can view this admin set, the should not be able to view
|
23
23
|
# it on the admin page.
|
24
|
-
let(:admin_set) { create(:admin_set, :public) }
|
24
|
+
let(:admin_set) { create(:admin_set, read_groups: ['public']) }
|
25
25
|
|
26
26
|
it 'is unauthorized' do
|
27
27
|
get :show, params: { id: admin_set }
|
@@ -2,10 +2,10 @@ RSpec.describe Hyrax::API::ItemsController, type: :controller do
|
|
2
2
|
let(:arkivo_actor) { double Hyrax::Arkivo::Actor }
|
3
3
|
let!(:user) { create(:user) }
|
4
4
|
let!(:default_work) do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
create(:work,
|
6
|
+
title: ['Foo Bar'],
|
7
|
+
user: user,
|
8
|
+
arkivo_checksum: '6872d21557992f6ad1d07375f19fbfaf')
|
9
9
|
end
|
10
10
|
|
11
11
|
before do
|
@@ -27,16 +27,13 @@ RSpec.describe Hyrax::BatchEditsController, type: :controller do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "update" do
|
30
|
+
let(:user) { build(:user) }
|
30
31
|
let!(:one) do
|
31
|
-
|
32
|
-
gw.apply_depositor_metadata('mjg36')
|
33
|
-
end
|
32
|
+
create(:generic_work, creator: ["Fred"], title: ["abc"], language: ['en'], user: user)
|
34
33
|
end
|
35
34
|
|
36
35
|
let!(:two) do
|
37
|
-
|
38
|
-
gw.apply_depositor_metadata('mjg36')
|
39
|
-
end
|
36
|
+
create(:generic_work, creator: ["Fred"], title: ["abc"], language: ['en'], user: user)
|
40
37
|
end
|
41
38
|
let(:mycontroller) { "hyrax/my/works" }
|
42
39
|
|
@@ -205,74 +205,93 @@ RSpec.describe Hyrax::Dashboard::CollectionsController do
|
|
205
205
|
end
|
206
206
|
end
|
207
207
|
|
208
|
-
#
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
208
|
+
describe "#show" do
|
209
|
+
context "when signed in" do
|
210
|
+
before do
|
211
|
+
sign_in user
|
212
|
+
[asset1, asset2, asset3].each do |asset|
|
213
|
+
asset.member_of_collections = [collection]
|
214
|
+
asset.save
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
it "returns the collection and its members" do
|
219
|
+
expect(controller).to receive(:add_breadcrumb).with(I18n.t('hyrax.dashboard.title'), Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
220
|
+
get :show, params: { id: collection }
|
221
|
+
expect(response).to be_successful
|
222
|
+
expect(assigns[:presenter]).to be_kind_of Hyrax::CollectionPresenter
|
223
|
+
expect(assigns[:presenter].title).to match_array collection.title
|
224
|
+
expect(assigns[:member_docs].map(&:id)).to match_array [asset1, asset2, asset3].map(&:id)
|
225
|
+
end
|
226
|
+
|
227
|
+
context "and searching" do
|
228
|
+
it "returns some works" do
|
229
|
+
# "/dashboard/collections/4m90dv529?utf8=%E2%9C%93&cq=King+Louie&sort="
|
230
|
+
get :show, params: { id: collection, cq: "Third" }
|
231
|
+
expect(assigns[:presenter]).to be_kind_of Hyrax::CollectionPresenter
|
232
|
+
expect(assigns[:member_docs].map(&:id)).to match_array [asset3].map(&:id)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
context 'when the page parameter is passed' do
|
237
|
+
it 'loads the collection (paying no attention to the page param)' do
|
238
|
+
get :show, params: { id: collection, page: '2' }
|
239
|
+
expect(response).to be_successful
|
240
|
+
expect(assigns[:presenter]).to be_kind_of Hyrax::CollectionPresenter
|
241
|
+
expect(assigns[:presenter].to_s).to eq 'My collection'
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
context "without a referer" do
|
246
|
+
it "sets breadcrumbs" do
|
247
|
+
expect(controller).to receive(:add_breadcrumb).with(I18n.t('hyrax.dashboard.title'), Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
248
|
+
get :show, params: { id: collection }
|
249
|
+
expect(response).to be_successful
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
context "with a referer" do
|
254
|
+
before do
|
255
|
+
request.env['HTTP_REFERER'] = 'http://test.host/foo'
|
256
|
+
end
|
257
|
+
|
258
|
+
it "sets breadcrumbs" do
|
259
|
+
expect(controller).to receive(:add_breadcrumb).with('My Dashboard', Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
260
|
+
expect(controller).to receive(:add_breadcrumb).with('Your Collections', Hyrax::Engine.routes.url_helpers.my_collections_path(locale: 'en'))
|
261
|
+
expect(controller).to receive(:add_breadcrumb).with('My collection', collection_path(collection.id, locale: 'en'))
|
262
|
+
get :show, params: { id: collection }
|
263
|
+
expect(response).to be_successful
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
context 'with admin user and private collection' do
|
269
|
+
let(:collection) do
|
270
|
+
create(:private_collection,
|
271
|
+
title: ["My collection"],
|
272
|
+
description: ["My incredibly detailed description of the collection"],
|
273
|
+
user: user)
|
274
|
+
end
|
275
|
+
let(:admin) { create(:admin) }
|
276
|
+
|
277
|
+
before do
|
278
|
+
sign_in admin
|
279
|
+
allow(controller.current_ability).to receive(:can?).with(:show, collection).and_return(true)
|
280
|
+
end
|
281
|
+
|
282
|
+
it "returns successfully" do
|
283
|
+
get :show, params: { id: collection }
|
284
|
+
expect(response).to be_successful
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
context "when not signed in" do
|
289
|
+
it "redirects to sign in page" do
|
290
|
+
get :show, params: { id: collection }
|
291
|
+
expect(response).to have_http_status(302)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
276
295
|
|
277
296
|
describe "#delete" do
|
278
297
|
before { sign_in user }
|
@@ -53,9 +53,9 @@ RSpec.describe Hyrax::Dashboard::ProfilesController do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
context "when the user has trophies" do
|
56
|
-
let(:work1) {
|
57
|
-
let(:work2) {
|
58
|
-
let(:work3) {
|
56
|
+
let(:work1) { create(:work, title: ["w1"], user: user) }
|
57
|
+
let(:work2) { create(:work, title: ["w2"], user: user) }
|
58
|
+
let(:work3) { create(:work, title: ["w3"], user: user) }
|
59
59
|
let!(:trophy1) { user.trophies.create!(work_id: work1.id) }
|
60
60
|
let!(:trophy2) { user.trophies.create!(work_id: work2.id) }
|
61
61
|
let!(:trophy3) { user.trophies.create!(work_id: work3.id) }
|
@@ -127,7 +127,7 @@ RSpec.describe Hyrax::Dashboard::ProfilesController do
|
|
127
127
|
expect(u.facebook_handle).to eq 'face'
|
128
128
|
expect(u.googleplus_handle).to eq 'goo'
|
129
129
|
expect(u.linkedin_handle).to eq 'link'
|
130
|
-
expect(u.orcid).to eq '
|
130
|
+
expect(u.orcid).to eq 'https://orcid.org/0000-0000-1111-2222'
|
131
131
|
end
|
132
132
|
|
133
133
|
it 'displays a flash when invalid ORCID is entered' do
|
@@ -138,7 +138,7 @@ RSpec.describe Hyrax::Dashboard::ProfilesController do
|
|
138
138
|
end
|
139
139
|
|
140
140
|
context "when removing a trophy" do
|
141
|
-
let(:work) {
|
141
|
+
let(:work) { create(:generic_work, title: ["w1"], user: user) }
|
142
142
|
|
143
143
|
before do
|
144
144
|
user.trophies.create!(work_id: work.id)
|
@@ -114,14 +114,10 @@ RSpec.describe Hyrax::FileSetsController do
|
|
114
114
|
describe "#destroy" do
|
115
115
|
context "file_set with a parent" do
|
116
116
|
let(:file_set) do
|
117
|
-
|
118
|
-
fs.apply_depositor_metadata(user)
|
119
|
-
end
|
117
|
+
create(:file_set, user: user)
|
120
118
|
end
|
121
119
|
let(:work) do
|
122
|
-
|
123
|
-
w.apply_depositor_metadata(user)
|
124
|
-
end
|
120
|
+
create(:work, title: ['test title'], user: user)
|
125
121
|
end
|
126
122
|
|
127
123
|
let(:delete_message) { double('delete message') }
|
@@ -143,9 +139,7 @@ RSpec.describe Hyrax::FileSetsController do
|
|
143
139
|
|
144
140
|
describe "#edit" do
|
145
141
|
let(:file_set) do
|
146
|
-
|
147
|
-
fs.apply_depositor_metadata(user)
|
148
|
-
end
|
142
|
+
create(:file_set, user: user)
|
149
143
|
end
|
150
144
|
|
151
145
|
before do
|
@@ -169,7 +163,7 @@ RSpec.describe Hyrax::FileSetsController do
|
|
169
163
|
|
170
164
|
describe "#update" do
|
171
165
|
let(:file_set) do
|
172
|
-
|
166
|
+
create(:file_set, user: user)
|
173
167
|
end
|
174
168
|
|
175
169
|
context "when updating metadata" do
|
@@ -283,9 +277,7 @@ RSpec.describe Hyrax::FileSetsController do
|
|
283
277
|
|
284
278
|
context "when there's an error saving" do
|
285
279
|
let(:file_set) do
|
286
|
-
|
287
|
-
fs.apply_depositor_metadata(user)
|
288
|
-
end
|
280
|
+
create(:file_set, user: user)
|
289
281
|
end
|
290
282
|
|
291
283
|
before do
|
@@ -303,9 +295,7 @@ RSpec.describe Hyrax::FileSetsController do
|
|
303
295
|
|
304
296
|
describe "#edit" do
|
305
297
|
let(:file_set) do
|
306
|
-
|
307
|
-
f.apply_depositor_metadata('archivist1@example.com')
|
308
|
-
end
|
298
|
+
create(:file_set, read_groups: ['public'])
|
309
299
|
end
|
310
300
|
|
311
301
|
let(:file) do
|
@@ -434,9 +424,7 @@ RSpec.describe Hyrax::FileSetsController do
|
|
434
424
|
end
|
435
425
|
|
436
426
|
let(:file_set) do
|
437
|
-
file_set =
|
438
|
-
gf.apply_depositor_metadata(user)
|
439
|
-
end
|
427
|
+
file_set = create(:file_set, user: user)
|
440
428
|
parent.ordered_members << file_set
|
441
429
|
parent.save
|
442
430
|
file_set
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec.describe Hyrax::FixityChecksController do
|
2
2
|
routes { Hyrax::Engine.routes }
|
3
3
|
let(:user) { create(:user) }
|
4
|
-
let(:file_set) {
|
4
|
+
let(:file_set) { create(:file_set, user: user) }
|
5
5
|
let(:binary) { File.open(fixture_path + '/world.png') }
|
6
6
|
let(:file) { Hydra::Derivatives::IoDecorator.new(binary, 'image/png', 'world.png') }
|
7
7
|
|
@@ -289,9 +289,7 @@ RSpec.describe Hyrax::GenericWorksController do
|
|
289
289
|
|
290
290
|
context "when a work id is passed" do
|
291
291
|
let(:work) do
|
292
|
-
|
293
|
-
w.apply_depositor_metadata(user)
|
294
|
-
end
|
292
|
+
create(:work, user: user, title: ['test title'])
|
295
293
|
end
|
296
294
|
|
297
295
|
it "records the work" do
|
@@ -1,10 +1,8 @@
|
|
1
1
|
RSpec.describe Hyrax::SingleUseLinksViewerController do
|
2
2
|
routes { Hyrax::Engine.routes }
|
3
|
+
let(:user) { build(:user) }
|
3
4
|
let(:file) do
|
4
|
-
|
5
|
-
lfile.label = 'world.png'
|
6
|
-
lfile.apply_depositor_metadata('mjg')
|
7
|
-
end
|
5
|
+
create(:file_set, label: 'world.png', user: user)
|
8
6
|
end
|
9
7
|
|
10
8
|
describe "retrieval links" do
|
@@ -42,6 +42,15 @@ RSpec.describe Hyrax::Forms::WorkForm do
|
|
42
42
|
|
43
43
|
it { is_expected.to match_array([args]) }
|
44
44
|
end
|
45
|
+
context 'when member of other collections' do
|
46
|
+
let(:args) { 'bar' }
|
47
|
+
|
48
|
+
before do
|
49
|
+
allow(work).to receive(:member_of_collection_ids).and_return(['foo'])
|
50
|
+
end
|
51
|
+
|
52
|
+
it { is_expected.to match_array(['foo', args]) }
|
53
|
+
end
|
45
54
|
end
|
46
55
|
|
47
56
|
describe "#[]" do
|
@@ -227,6 +236,22 @@ RSpec.describe Hyrax::Forms::WorkForm do
|
|
227
236
|
it { is_expected.to eq work.embargo_release_date }
|
228
237
|
end
|
229
238
|
|
239
|
+
describe "#visibility_during_embargo" do
|
240
|
+
let(:work) { create(:work, visibility_during_embargo: 'authenticated') }
|
241
|
+
|
242
|
+
subject { form.visibility_during_embargo }
|
243
|
+
|
244
|
+
it { is_expected.to eq work.visibility_during_embargo }
|
245
|
+
end
|
246
|
+
|
247
|
+
describe "#visibility_after_embargo" do
|
248
|
+
let(:work) { create(:work, visibility_after_embargo: 'public') }
|
249
|
+
|
250
|
+
subject { form.visibility_after_embargo }
|
251
|
+
|
252
|
+
it { is_expected.to eq work.visibility_after_embargo }
|
253
|
+
end
|
254
|
+
|
230
255
|
describe "#lease_expiration_date" do
|
231
256
|
let(:work) { create(:work, lease_expiration_date: 2.days.from_now) }
|
232
257
|
|
@@ -235,6 +260,22 @@ RSpec.describe Hyrax::Forms::WorkForm do
|
|
235
260
|
it { is_expected.to eq work.lease_expiration_date }
|
236
261
|
end
|
237
262
|
|
263
|
+
describe "#visibility_during_lease" do
|
264
|
+
let(:work) { create(:work, visibility_during_lease: 'authenticated') }
|
265
|
+
|
266
|
+
subject { form.visibility_during_lease }
|
267
|
+
|
268
|
+
it { is_expected.to eq work.visibility_during_lease }
|
269
|
+
end
|
270
|
+
|
271
|
+
describe "#visibility_after_lease" do
|
272
|
+
let(:work) { create(:work, visibility_after_lease: 'private') }
|
273
|
+
|
274
|
+
subject { form.visibility_after_lease }
|
275
|
+
|
276
|
+
it { is_expected.to eq work.visibility_after_lease }
|
277
|
+
end
|
278
|
+
|
238
279
|
describe ".workflow_for" do
|
239
280
|
subject { described_class.send(:workflow_for, admin_set_id: admin_set.id) }
|
240
281
|
|