curation_concerns 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/Gemfile +5 -0
- data/app/actors/curation_concerns/actors/actor_stack.rb +20 -4
- data/app/actors/curation_concerns/actors/base_actor.rb +1 -1
- data/app/assets/javascripts/curation_concerns/boot.es6 +6 -0
- data/app/assets/javascripts/curation_concerns/curation_concerns.js +5 -5
- data/app/assets/javascripts/curation_concerns/file_manager.es6 +41 -0
- data/app/assets/javascripts/curation_concerns/file_manager/member.es6 +2 -8
- data/app/assets/javascripts/curation_concerns/file_manager/save_manager.es6 +1 -3
- data/app/assets/javascripts/curation_concerns/file_manager/sorting.es6 +69 -75
- data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +1 -1
- data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +3 -3
- data/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +5 -7
- data/app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb +6 -5
- data/app/models/concerns/curation_concerns/solr_document_behavior.rb +23 -4
- data/app/services/curation_concerns/time_service.rb +2 -1
- data/app/views/curation_concerns/file_sets/show.json.jbuilder +1 -1
- data/curation_concerns.gemspec +2 -1
- data/lib/curation_concerns/engine.rb +1 -0
- data/lib/curation_concerns/version.rb +1 -1
- data/solr/config/solrconfig.xml +26 -4
- data/spec/actors/curation_concerns/apply_order_actor_spec.rb +6 -4
- data/spec/actors/curation_concerns/file_set_actor_spec.rb +3 -3
- data/spec/actors/curation_concerns/work_actor_spec.rb +8 -7
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/controllers/curation_concerns/collections_controller_spec.rb +1 -1
- data/spec/controllers/curation_concerns/file_sets_controller_json_spec.rb +29 -5
- data/spec/controllers/curation_concerns/file_sets_controller_spec.rb +20 -4
- data/spec/controllers/curation_concerns/generic_works_controller_json_spec.rb +3 -2
- data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +6 -1
- data/spec/factories/generic_works.rb +2 -2
- data/spec/features/create_work_spec.rb +1 -1
- data/spec/features/update_file_spec.rb +7 -0
- data/spec/features/work_generator_spec.rb +1 -1
- data/spec/models/collection_spec.rb +3 -3
- data/spec/models/curation_concerns/work_behavior_spec.rb +2 -1
- data/spec/models/file_set_spec.rb +2 -1
- data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +0 -1
- data/spec/services/file_set_audit_service_spec.rb +14 -0
- data/spec/services/graph_exporter_spec.rb +1 -1
- data/spec/spec_helper.rb +13 -0
- data/spec/support/helpers/controller_level_helpers.rb +27 -0
- data/spec/support/views/test_view_helpers.rb +10 -0
- data/spec/test_app_templates/Gemfile.extra +2 -0
- data/spec/views/catalog/index.html.erb_spec.rb +0 -3
- data/spec/views/curation_concerns/base/_form_rights_spec.rb +9 -7
- data/spec/views/curation_concerns/file_sets/show.json.jbuilder_spec.rb +6 -6
- metadata +24 -11
- data/app/assets/javascripts/curation_concerns/file_manager/affix.es6 +0 -13
@@ -16,16 +16,35 @@ module CurationConcerns
|
|
16
16
|
title_or_label
|
17
17
|
end
|
18
18
|
|
19
|
+
class ModelWrapper
|
20
|
+
def initialize(model, id)
|
21
|
+
@model = model
|
22
|
+
@id = id
|
23
|
+
end
|
24
|
+
|
25
|
+
def persisted?
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_param
|
30
|
+
@id
|
31
|
+
end
|
32
|
+
|
33
|
+
def model_name
|
34
|
+
@model.model_name
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_partial_path
|
38
|
+
@model._to_partial_path
|
39
|
+
end
|
40
|
+
end
|
19
41
|
##
|
20
42
|
# Offer the source (ActiveFedora-based) model to Rails for some of the
|
21
43
|
# Rails methods (e.g. link_to).
|
22
44
|
# @example
|
23
45
|
# link_to '...', SolrDocument(:id => 'bXXXXXX5').new => <a href="/dams_object/bXXXXXX5">...</a>
|
24
46
|
def to_model
|
25
|
-
@model ||=
|
26
|
-
m = ActiveFedora::Base.load_instance_from_solr(id, self)
|
27
|
-
m.class == ActiveFedora::Base ? self : m
|
28
|
-
end
|
47
|
+
@model ||= ModelWrapper.new(hydra_model, id)
|
29
48
|
end
|
30
49
|
|
31
50
|
def collection?
|
@@ -1 +1 @@
|
|
1
|
-
json.extract! @
|
1
|
+
json.extract! @presenter, :id, :title, :label, :description, :creator
|
data/curation_concerns.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency 'hydra-head', '>= 10.0.0', '< 11'
|
22
|
-
spec.add_dependency 'active-fedora', '>=
|
22
|
+
spec.add_dependency 'active-fedora', '>= 11.0.0.rc6'
|
23
23
|
spec.add_dependency 'blacklight', '~> 6.3'
|
24
24
|
spec.add_dependency 'breadcrumbs_on_rails', '>= 2.3', '< 4'
|
25
25
|
spec.add_dependency 'jquery-ui-rails'
|
@@ -51,6 +51,7 @@ Gem::Specification.new do |spec|
|
|
51
51
|
spec.add_development_dependency "rspec-its"
|
52
52
|
spec.add_development_dependency "rspec-rails"
|
53
53
|
spec.add_development_dependency 'rspec-html-matchers'
|
54
|
+
spec.add_development_dependency 'equivalent-xml'
|
54
55
|
spec.add_development_dependency 'rspec-activemodel-mocks', '~> 1.0'
|
55
56
|
spec.add_development_dependency "capybara", '~> 2.5'
|
56
57
|
spec.add_development_dependency "poltergeist", ">= 1.5.0"
|
data/solr/config/solrconfig.xml
CHANGED
@@ -57,6 +57,21 @@
|
|
57
57
|
<defaultQuery>*:*</defaultQuery>
|
58
58
|
</admin>
|
59
59
|
|
60
|
+
<updateHandler class="solr.DirectUpdateHandler2">
|
61
|
+
<updateLog>
|
62
|
+
<str name="dir">${solr.ulog.dir:}</str>
|
63
|
+
</updateLog>
|
64
|
+
|
65
|
+
<autoCommit>
|
66
|
+
<maxTime>${solr.autoCommit.maxTime:15000}</maxTime>
|
67
|
+
<openSearcher>false</openSearcher>
|
68
|
+
</autoCommit>
|
69
|
+
|
70
|
+
<autoSoftCommit>
|
71
|
+
<maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime>
|
72
|
+
</autoSoftCommit>
|
73
|
+
</updateHandler>
|
74
|
+
|
60
75
|
<!-- SearchHandler
|
61
76
|
|
62
77
|
http://wiki.apache.org/solr/SearchHandler
|
@@ -87,7 +102,6 @@
|
|
87
102
|
-->
|
88
103
|
<str name="qf">
|
89
104
|
id
|
90
|
-
active_fedora_model_ssi
|
91
105
|
title_tesim
|
92
106
|
author_tesim
|
93
107
|
subject_tesim
|
@@ -119,9 +133,6 @@
|
|
119
133
|
|
120
134
|
<str name="facet">true</str>
|
121
135
|
<str name="facet.mincount">1</str>
|
122
|
-
<str name="facet.limit">10</str>
|
123
|
-
<str name="facet.field">active_fedora_model_ssi</str>
|
124
|
-
<str name="facet.field">subject_sim</str>
|
125
136
|
|
126
137
|
<str name="spellcheck">true</str>
|
127
138
|
<str name="spellcheck.dictionary">default</str>
|
@@ -176,6 +187,17 @@
|
|
176
187
|
</lst>
|
177
188
|
</requestHandler>
|
178
189
|
|
190
|
+
<searchComponent name="termsComponent" class="solr.TermsComponent" />
|
191
|
+
|
192
|
+
<requestHandler name="/terms" class="solr.SearchHandler">
|
193
|
+
<lst name="defaults">
|
194
|
+
<bool name="terms">true</bool>
|
195
|
+
</lst>
|
196
|
+
<arr name="components">
|
197
|
+
<str>termsComponent</str>
|
198
|
+
</arr>
|
199
|
+
</requestHandler>
|
200
|
+
|
179
201
|
<!-- Spell Check
|
180
202
|
|
181
203
|
The spell check component can return a list of alternative spelling
|
@@ -14,7 +14,7 @@ describe CurationConcerns::Actors::ApplyOrderActor do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
context 'with ordered_member_ids that are already associated with the parent' do
|
17
|
-
let(:attributes) { { ordered_member_ids: ["
|
17
|
+
let(:attributes) { { ordered_member_ids: ["BlahBlah1"] } }
|
18
18
|
let(:root_actor) { double }
|
19
19
|
before do
|
20
20
|
allow(CurationConcerns::Actors::RootActor).to receive(:new).and_return(root_actor)
|
@@ -31,7 +31,7 @@ describe CurationConcerns::Actors::ApplyOrderActor do
|
|
31
31
|
describe '#update' do
|
32
32
|
let(:user) { create(:admin) }
|
33
33
|
let(:curation_concern) { create(:work_with_one_child, user: user) }
|
34
|
-
let(:child) { GenericWork.new("
|
34
|
+
let(:child) { GenericWork.new(id: "blahblah3") }
|
35
35
|
|
36
36
|
subject do
|
37
37
|
CurationConcerns::Actors::ActorStack.new(curation_concern,
|
@@ -41,17 +41,19 @@ describe CurationConcerns::Actors::ApplyOrderActor do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
context 'with ordered_members_ids that arent associated with the curation concern yet.' do
|
44
|
-
let(:attributes) { { ordered_member_ids: [
|
44
|
+
let(:attributes) { { ordered_member_ids: [child.id] } }
|
45
45
|
let(:root_actor) { double }
|
46
46
|
before do
|
47
47
|
allow(CurationConcerns::Actors::RootActor).to receive(:new).and_return(root_actor)
|
48
48
|
allow(root_actor).to receive(:update).with({}).and_return(true)
|
49
|
+
# TODO: This can be moved into the Factory
|
49
50
|
child.title = ["Generic Title"]
|
50
51
|
child.apply_depositor_metadata(user.user_key)
|
51
52
|
child.save!
|
52
53
|
curation_concern.apply_depositor_metadata(user.user_key)
|
53
54
|
curation_concern.save!
|
54
55
|
end
|
56
|
+
|
55
57
|
it "attaches the parent" do
|
56
58
|
expect(subject.update(attributes)).to be true
|
57
59
|
end
|
@@ -59,7 +61,7 @@ describe CurationConcerns::Actors::ApplyOrderActor do
|
|
59
61
|
|
60
62
|
context 'without an ordered_member_id that was associated with the curation concern' do
|
61
63
|
let(:curation_concern) { create(:work_with_two_children, user: user) }
|
62
|
-
let(:attributes) { { ordered_member_ids: ["
|
64
|
+
let(:attributes) { { ordered_member_ids: ["BlahBlah2"] } }
|
63
65
|
let(:root_actor) { double }
|
64
66
|
before do
|
65
67
|
allow(CurationConcerns::Actors::RootActor).to receive(:new).and_return(root_actor)
|
@@ -108,7 +108,7 @@ describe CurationConcerns::Actors::FileSetActor do
|
|
108
108
|
|
109
109
|
subject { file_set.title }
|
110
110
|
|
111
|
-
it { is_expected.to
|
111
|
+
it { is_expected.to match_array [short_name] }
|
112
112
|
end
|
113
113
|
|
114
114
|
context 'when a label is already specified' do
|
@@ -159,11 +159,11 @@ describe CurationConcerns::Actors::FileSetActor do
|
|
159
159
|
end
|
160
160
|
|
161
161
|
it "removes representative, thumbnail, and the proxy association" do
|
162
|
-
gw = GenericWork.
|
162
|
+
gw = GenericWork.find(work.id)
|
163
163
|
expect(gw.representative_id).to eq(file_set.id)
|
164
164
|
expect(gw.thumbnail_id).to eq(file_set.id)
|
165
165
|
expect { actor.destroy }.to change { ActiveFedora::Aggregation::Proxy.count }.by(-1)
|
166
|
-
gw = GenericWork.
|
166
|
+
gw = GenericWork.find(work.id)
|
167
167
|
expect(gw.representative_id).to be_nil
|
168
168
|
expect(gw.thumbnail_id).to be_nil
|
169
169
|
end
|
@@ -94,13 +94,15 @@ describe CurationConcerns::Actors::GenericWorkActor do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
context 'authenticated visibility' do
|
97
|
+
let(:file_actor) { double }
|
97
98
|
before do
|
98
99
|
allow(CurationConcerns::TimeService).to receive(:time_in_utc) { xmas }
|
99
100
|
redlock_client_stub
|
101
|
+
allow(CurationConcerns::Actors::FileActor).to receive(:new).and_return(file_actor)
|
100
102
|
end
|
101
103
|
|
102
104
|
it 'stamps each file with the access rights' do
|
103
|
-
expect(
|
105
|
+
expect(file_actor).to receive(:ingest_file).and_return(true)
|
104
106
|
expect(subject.create(attributes)).to be true
|
105
107
|
expect(curation_concern).to be_persisted
|
106
108
|
expect(curation_concern.date_uploaded).to eq xmas
|
@@ -108,18 +110,16 @@ describe CurationConcerns::Actors::GenericWorkActor do
|
|
108
110
|
expect(curation_concern.depositor).to eq user.user_key
|
109
111
|
expect(curation_concern.representative).to_not be_nil
|
110
112
|
expect(curation_concern.file_sets.size).to eq 1
|
111
|
-
# Sanity test to make sure the file we uploaded is stored and has same permission as parent.
|
112
|
-
file_set = curation_concern.file_sets.first
|
113
|
-
file.rewind
|
114
|
-
expect(file_set.reload.original_file.content).to eq file.read
|
115
|
-
|
116
113
|
expect(curation_concern).to be_authenticated_only_access
|
114
|
+
# Sanity test to make sure the file_set has same permission as parent.
|
115
|
+
file_set = curation_concern.file_sets.first
|
117
116
|
expect(file_set).to be_authenticated_only_access
|
118
117
|
end
|
119
118
|
end
|
120
119
|
end
|
121
120
|
|
122
121
|
context 'with multiple files file' do
|
122
|
+
let(:file_actor) { double }
|
123
123
|
let(:attributes) do
|
124
124
|
FactoryGirl.attributes_for(:generic_work, visibility: visibility).tap do |a|
|
125
125
|
a[:files] = [file, file]
|
@@ -130,10 +130,11 @@ describe CurationConcerns::Actors::GenericWorkActor do
|
|
130
130
|
before do
|
131
131
|
allow(CurationConcerns::TimeService).to receive(:time_in_utc) { xmas }
|
132
132
|
redlock_client_stub
|
133
|
+
allow(CurationConcerns::Actors::FileActor).to receive(:new).and_return(file_actor)
|
133
134
|
end
|
134
135
|
|
135
136
|
it 'stamps each file with the access rights' do
|
136
|
-
expect(
|
137
|
+
expect(file_actor).to receive(:ingest_file).and_return(true).twice
|
137
138
|
|
138
139
|
expect(subject.create(attributes)).to be true
|
139
140
|
expect(curation_concern).to be_persisted
|
@@ -72,7 +72,7 @@ describe CatalogController do
|
|
72
72
|
let!(:work) { FactoryGirl.create(:generic_work, user: user, title: ["All my #{srand}"]) }
|
73
73
|
render_views
|
74
74
|
it 'returns json' do
|
75
|
-
xhr :get, :index, format: :json, q: work.title
|
75
|
+
xhr :get, :index, format: :json, q: work.title.first
|
76
76
|
json = JSON.parse(response.body)
|
77
77
|
# Grab the doc corresponding to work and inspect the json
|
78
78
|
work_json = json['docs'].first
|
@@ -127,7 +127,7 @@ describe CollectionsController do
|
|
127
127
|
batch_document_ids: [asset4.id]
|
128
128
|
}.to change { collection.reload.members.size }.by(1)
|
129
129
|
expect(response).to redirect_to routes.url_helpers.collection_path(collection)
|
130
|
-
expect(assigns[:collection].members).to
|
130
|
+
expect(assigns[:collection].members).to match_array [asset1, asset2, asset4]
|
131
131
|
|
132
132
|
asset_results = ActiveFedora::SolrService.instance.conn.get 'select', params: { fq: ["id:\"#{asset2.id}\""], fl: ['id'] }
|
133
133
|
expect(asset_results['response']['numFound']).to eq 1
|
@@ -16,6 +16,7 @@ describe CurationConcerns::FileSetsController do
|
|
16
16
|
context "JSON" do
|
17
17
|
let(:resource) { file_set }
|
18
18
|
let(:resource_request) { get :show, id: resource, format: :json }
|
19
|
+
let(:actor) { controller.send(:actor) }
|
19
20
|
subject { response }
|
20
21
|
describe "unauthorized" do
|
21
22
|
before do
|
@@ -35,13 +36,22 @@ describe CurationConcerns::FileSetsController do
|
|
35
36
|
|
36
37
|
describe 'not found' do
|
37
38
|
before { get :show, id: "non-existent-pid", format: :json }
|
38
|
-
|
39
|
+
# Respond with forbidden to protect against object enumeration attack
|
40
|
+
it { is_expected.to respond_forbidden }
|
39
41
|
end
|
40
42
|
|
41
43
|
describe 'created' do
|
42
44
|
it "returns 201, renders jq_upload json template and sets location header" do
|
43
|
-
|
44
|
-
|
45
|
+
if Rails.version < '5.0.0'
|
46
|
+
expect(actor).to receive(:create_metadata).with(parent, hash_including(:files, title: ['a title']))
|
47
|
+
expect(actor).to receive(:create_content).with(file).and_return(true)
|
48
|
+
else
|
49
|
+
expect(actor).to receive(:create_metadata).with(parent, ActionController::Parameters) do |_work, ac_params|
|
50
|
+
expect(ac_params['files'].map(&:class)).to eq [ActionDispatch::Http::UploadedFile]
|
51
|
+
expect(ac_params['title']).to eq ['a title']
|
52
|
+
end
|
53
|
+
expect(actor).to receive(:create_content).with(ActionDispatch::Http::UploadedFile).and_return(true)
|
54
|
+
end
|
45
55
|
|
46
56
|
allow_any_instance_of(FileSet).to receive(:persisted?).and_return(true)
|
47
57
|
allow_any_instance_of(FileSet).to receive(:to_param).and_return('999')
|
@@ -83,7 +93,8 @@ describe CurationConcerns::FileSetsController do
|
|
83
93
|
describe 'found' do
|
84
94
|
before { resource_request }
|
85
95
|
it "returns json of the work" do
|
86
|
-
|
96
|
+
# this object is used by the jbuilder template
|
97
|
+
expect(assigns[:presenter]).to be_instance_of CurationConcerns::FileSetPresenter
|
87
98
|
expect(controller).to render_template('curation_concerns/file_sets/show')
|
88
99
|
expect(response.code).to eq "200"
|
89
100
|
end
|
@@ -95,7 +106,12 @@ describe CurationConcerns::FileSetsController do
|
|
95
106
|
allow(controller).to receive(:actor).and_return(actor)
|
96
107
|
end
|
97
108
|
it "returns json of updated work and sets location header" do
|
98
|
-
|
109
|
+
expected_params = { title: ['updated title'] }
|
110
|
+
if Rails.version < '5.0.0'
|
111
|
+
expect(actor).to receive(:update_metadata).with(expected_params).and_return(true)
|
112
|
+
else
|
113
|
+
expect(actor).to receive(:update_metadata).with(ActionController::Parameters.new(expected_params).permit!).and_return(true)
|
114
|
+
end
|
99
115
|
put :update, id: resource, file_set: { title: ['updated title'] }, format: :json
|
100
116
|
expect(assigns[:file_set]).to be_instance_of ::FileSet # this object is used by the jbuilder template
|
101
117
|
expect(response.status).to eq 200
|
@@ -105,6 +121,14 @@ describe CurationConcerns::FileSetsController do
|
|
105
121
|
end
|
106
122
|
end
|
107
123
|
|
124
|
+
describe "integration update" do
|
125
|
+
render_views
|
126
|
+
it "works" do
|
127
|
+
put :update, id: resource.id, file_set: { title: ['test'] }, format: :json
|
128
|
+
expect(response.status).to eq 200
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
108
132
|
describe 'failed update' do
|
109
133
|
before {
|
110
134
|
expect(controller).to receive(:update_metadata) do
|
@@ -15,14 +15,30 @@ describe CurationConcerns::FileSetsController do
|
|
15
15
|
|
16
16
|
context 'on the happy path' do
|
17
17
|
let(:date_today) { DateTime.now }
|
18
|
+
let(:expected_params) do
|
19
|
+
{ files: [file],
|
20
|
+
title: ['test title'],
|
21
|
+
visibility: 'restricted' }
|
22
|
+
end
|
23
|
+
let(:actor) { controller.send(:actor) }
|
18
24
|
|
19
25
|
before do
|
20
26
|
allow(DateTime).to receive(:now).and_return(date_today)
|
21
27
|
end
|
22
28
|
|
23
29
|
it 'calls the actor to create metadata and content' do
|
24
|
-
|
25
|
-
|
30
|
+
if Rails.version < '5.0.0'
|
31
|
+
expect(actor).to receive(:create_metadata).with(parent, expected_params)
|
32
|
+
expect(actor).to receive(:create_content).with(file).and_return(true)
|
33
|
+
else
|
34
|
+
expect(actor).to receive(:create_metadata).with(parent, ActionController::Parameters) do |_work, ac_params|
|
35
|
+
expect(ac_params['files'].map(&:class)).to eq [ActionDispatch::Http::UploadedFile]
|
36
|
+
expect(ac_params['title']).to eq expected_params[:title]
|
37
|
+
expect(ac_params['visibility']).to eq expected_params[:visibility]
|
38
|
+
end
|
39
|
+
expect(actor).to receive(:create_content).with(ActionDispatch::Http::UploadedFile).and_return(true)
|
40
|
+
end
|
41
|
+
|
26
42
|
xhr :post, :create, parent_id: parent,
|
27
43
|
file_set: { files: [file],
|
28
44
|
title: ['test title'],
|
@@ -62,7 +78,7 @@ describe CurationConcerns::FileSetsController do
|
|
62
78
|
context 'when solr is down' do
|
63
79
|
before do
|
64
80
|
allow(controller.send(:actor)).to receive(:create_metadata)
|
65
|
-
allow(controller.send(:actor)).to receive(:create_content).
|
81
|
+
allow(controller.send(:actor)).to receive(:create_content).and_raise(RSolr::Error::Http.new({}, {}))
|
66
82
|
end
|
67
83
|
|
68
84
|
it 'errors out of create after on continuous rsolr error' do
|
@@ -75,7 +91,7 @@ describe CurationConcerns::FileSetsController do
|
|
75
91
|
context 'when the file is not created' do
|
76
92
|
before do
|
77
93
|
allow(controller.send(:actor)).to receive(:create_metadata)
|
78
|
-
allow(controller.send(:actor)).to receive(:create_content).
|
94
|
+
allow(controller.send(:actor)).to receive(:create_content).and_return(false)
|
79
95
|
end
|
80
96
|
|
81
97
|
it 'errors out of create after on continuous rsolr error' do
|
@@ -75,8 +75,9 @@ describe CurationConcerns::GenericWorksController do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
describe 'failed update' do
|
78
|
-
before
|
79
|
-
|
78
|
+
before do
|
79
|
+
post :update, id: resource, generic_work: { title: [''] }, format: :json
|
80
|
+
end
|
80
81
|
it "returns 422 and the errors" do
|
81
82
|
expect(response).to respond_unprocessable_entity(errors: { title: ["Your work must have a title."] })
|
82
83
|
end
|
@@ -180,7 +180,12 @@ describe CurationConcerns::GenericWorksController do
|
|
180
180
|
|
181
181
|
it "can update file membership" do
|
182
182
|
patch :update, id: work, generic_work: { ordered_member_ids: ['foo_123'] }
|
183
|
-
|
183
|
+
expected_params = { ordered_member_ids: ['foo_123'] }
|
184
|
+
if Rails.version < '5.0.0'
|
185
|
+
expect(actor).to have_received(:update).with(expected_params)
|
186
|
+
else
|
187
|
+
expect(actor).to have_received(:update).with(ActionController::Parameters.new(expected_params).permit!)
|
188
|
+
end
|
184
189
|
end
|
185
190
|
|
186
191
|
describe 'changing rights' do
|
@@ -31,8 +31,8 @@ FactoryGirl.define do
|
|
31
31
|
|
32
32
|
factory :work_with_two_children do
|
33
33
|
before(:create) do |work, evaluator|
|
34
|
-
work.ordered_members << FactoryGirl.create(:generic_work, user: evaluator.user, title: ['A Contained Work'], id: "
|
35
|
-
work.ordered_members << FactoryGirl.create(:generic_work, user: evaluator.user, title: ['Another Contained Work'], id: "
|
34
|
+
work.ordered_members << FactoryGirl.create(:generic_work, user: evaluator.user, title: ['A Contained Work'], id: "BlahBlah1")
|
35
|
+
work.ordered_members << FactoryGirl.create(:generic_work, user: evaluator.user, title: ['Another Contained Work'], id: "BlahBlah2")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -15,7 +15,7 @@ feature 'Creating a new Work' do
|
|
15
15
|
sign_in user
|
16
16
|
|
17
17
|
# stub out characterization. Travis doesn't have fits installed, and it's not relevant to the test.
|
18
|
-
|
18
|
+
allow(CharacterizeJob).to receive(:perform_later)
|
19
19
|
redlock_client_stub
|
20
20
|
end
|
21
21
|
|