hydra-collections 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +0 -1
- data/Changelog.md +12 -0
- data/app/controllers/concerns/hydra/collections_controller_behavior.rb +1 -1
- data/lib/hydra/collections/version.rb +1 -1
- data/spec/controllers/collections_controller_spec.rb +58 -53
- data/spec/controllers/other_collections_controller_spec.rb +4 -3
- data/tasks/hydra-collections-dev.rake +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66c141437035384dcd06f340506ab837348c902a
|
4
|
+
data.tar.gz: a817c59334b68041937292aabe05532713bd08a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b4b34237bd666aa7f5ff1b7223f158111085c4a9c52260eea3998b5a01aff1e3969474f41b473633b2405c663b1a9be08f2abcd31905d39fe8c6aab0dfee7e7
|
7
|
+
data.tar.gz: 3390a8a96bb94996a2101111a12a9060a554985c3da39bc4469429f055d3eb7627843d0b61c4c03e102bf893eb57737091eba1423d432fdf3e8c70245c0fe929
|
data/.rspec
CHANGED
data/Changelog.md
CHANGED
@@ -131,7 +131,7 @@ module Hydra
|
|
131
131
|
|
132
132
|
# Defines which search_params_logic should be used when searching for Collection members
|
133
133
|
def collection_member_search_logic
|
134
|
-
search_params_logic + [:include_collection_ids]
|
134
|
+
search_params_logic + [:include_collection_ids, :add_access_controls_to_solr_params]
|
135
135
|
end
|
136
136
|
|
137
137
|
def collection_params
|
@@ -12,6 +12,7 @@ describe CollectionsController, :type => :controller do
|
|
12
12
|
|
13
13
|
class GenericFile < ActiveFedora::Base
|
14
14
|
include Hydra::Collections::Collectible
|
15
|
+
include Hydra::AccessControls::Permissions
|
15
16
|
|
16
17
|
property :title, predicate: ::RDF::DC.title, multiple: false
|
17
18
|
|
@@ -215,73 +216,77 @@ describe CollectionsController, :type => :controller do
|
|
215
216
|
end
|
216
217
|
end
|
217
218
|
|
218
|
-
describe "
|
219
|
+
describe "#show" do
|
219
220
|
before do
|
220
|
-
@asset1 = GenericFile.create!(title: "First of the Assets")
|
221
|
-
@asset2 = GenericFile.create!(title: "Second of the Assets")
|
222
|
-
@asset3 = GenericFile.create!(title: "Third of the Assets")
|
223
|
-
@collection = Collection.new(id:"abc123")
|
224
|
-
@collection.title = "My collection"
|
225
|
-
@collection.apply_depositor_metadata(user.user_key)
|
226
|
-
@collection.members = [@asset1, @asset2, @asset3]
|
227
|
-
@collection.save!
|
228
221
|
expect(controller).to receive(:authorize!).and_return(true)
|
229
|
-
allow(controller).to receive(:apply_gated_search)
|
230
222
|
end
|
231
223
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
@collection2.save
|
224
|
+
context "when there are no assets in the collection" do
|
225
|
+
let(:collection) { Collection.create(title: "Empty collection") }
|
226
|
+
it "shows no assets" do
|
227
|
+
get :show, id: collection
|
228
|
+
expect(response).to be_successful
|
229
|
+
expect(assigns[:collection].title).to eq("Empty collection")
|
230
|
+
expect(assigns[:member_docs]).to be_empty
|
240
231
|
end
|
232
|
+
end
|
241
233
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
234
|
+
context "with a number of assets" do
|
235
|
+
let(:asset1) { GenericFile.create!(title: "First of the Assets", read_users: [user.user_key]) }
|
236
|
+
let(:asset2) { GenericFile.create!(title: "Second of the Assets", read_users: [user.user_key]) }
|
237
|
+
let(:asset3) { GenericFile.create!(title: "Third of the Assets", read_users: [user.user_key]) }
|
238
|
+
let!(:collection) do
|
239
|
+
Collection.create!(id: "abc123", title: "My collection",
|
240
|
+
members: [asset1, asset2, asset3]) do |col|
|
241
|
+
col.apply_depositor_metadata(user.user_key)
|
242
|
+
end
|
246
243
|
end
|
247
244
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
expect(assigns[:
|
245
|
+
# NOTE: This test depends on title_tesim being in the qf in solrconfig.xml
|
246
|
+
it "queries the collections" do
|
247
|
+
get :show, id: collection, cq:"\"#{asset1.title}\""
|
248
|
+
expect(assigns[:collection].title).to eq collection.title
|
249
|
+
expect(assigns[:member_docs].map(&:id)).to match_array [asset1.id]
|
252
250
|
end
|
253
|
-
end
|
254
251
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
252
|
+
it "returns the specified number of rows" do
|
253
|
+
get :show, id: collection, rows: "2"
|
254
|
+
expect(assigns[:collection].title).to eq collection.title
|
255
|
+
expect(assigns[:member_docs].size).to eq 2
|
256
|
+
end
|
260
257
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
258
|
+
describe "additional collections" do
|
259
|
+
let(:asset4) { GenericFile.create!(title: "#{asset1.id}", read_users: [user.user_key]) }
|
260
|
+
let!(:collection2) do
|
261
|
+
Collection.create!(id: "abc1234", title: "Other collection", members: [asset4]) do |col|
|
262
|
+
col.apply_depositor_metadata(user.user_key)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
it "shows only the collections assets" do
|
266
|
+
get :show, id: collection
|
267
|
+
expect(assigns[:collection].title).to eq collection.title
|
268
|
+
expect(assigns[:member_docs].map(&:id)).to match_array [asset1.id, asset2.id, asset3.id]
|
269
|
+
end
|
267
270
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
# NOTE: This test depends on title_tesim being in the qf in solrconfig.xml
|
274
|
-
it "should query the collections and show only the collection assets" do
|
275
|
-
get :show, id: @collection, cq: "\"#{@asset1.title}\""
|
276
|
-
expect(assigns[:collection].title).to eq @collection.title
|
277
|
-
expect(assigns[:member_docs].map(&:id)).to match_array [@asset1.id]
|
271
|
+
it "shows only the other collections assets" do
|
272
|
+
get :show, id: collection2
|
273
|
+
expect(assigns[:collection].title).to eq collection2.title
|
274
|
+
expect(assigns[:member_docs].map(&:id)).to match_array [asset4.id]
|
275
|
+
end
|
278
276
|
end
|
279
|
-
end
|
280
277
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
278
|
+
context "When there are search matches that are not in the collection" do
|
279
|
+
before do
|
280
|
+
GenericFile.create!(title: "#{asset1.id} #{asset1.title}")
|
281
|
+
GenericFile.create!(title: asset1.title.to_s)
|
282
|
+
end
|
283
|
+
# NOTE: This test depends on title_tesim being in the qf in solrconfig.xml
|
284
|
+
it "only shows the collection assets" do
|
285
|
+
get :show, id: collection, cq: "\"#{asset1.title}\""
|
286
|
+
expect(assigns[:collection].title).to eq collection.title
|
287
|
+
expect(assigns[:member_docs].map(&:id)).to match_array [asset1.id]
|
288
|
+
end
|
289
|
+
end
|
285
290
|
end
|
286
291
|
end
|
287
292
|
end
|
@@ -10,6 +10,7 @@ describe OtherCollectionsController, :type => :controller do
|
|
10
10
|
|
11
11
|
class Member < ActiveFedora::Base
|
12
12
|
include Hydra::Collections::Collectible
|
13
|
+
include Hydra::AccessControls::Permissions
|
13
14
|
attr_accessor :title
|
14
15
|
end
|
15
16
|
end
|
@@ -29,9 +30,9 @@ describe OtherCollectionsController, :type => :controller do
|
|
29
30
|
end
|
30
31
|
|
31
32
|
describe "#show" do
|
32
|
-
let(:asset1) { Member.create!(title: "First of the Assets") }
|
33
|
-
let(:asset2) { Member.create!(title: "Second of the Assets") }
|
34
|
-
let(:asset3) { Member.create!(title: "Third of the Assets") }
|
33
|
+
let(:asset1) { Member.create!(title: "First of the Assets", read_users: [user.user_key]) }
|
34
|
+
let(:asset2) { Member.create!(title: "Second of the Assets", read_users: [user.user_key]) }
|
35
|
+
let(:asset3) { Member.create!(title: "Third of the Assets", read_users: [user.user_key]) }
|
35
36
|
let(:collection) do
|
36
37
|
OtherCollection.create(id: 'foo123', title: "My collection",
|
37
38
|
members: [asset1, asset2, asset3]) do |collection|
|
@@ -5,7 +5,9 @@ require 'engine_cart/rake_task'
|
|
5
5
|
|
6
6
|
Jettywrapper.hydra_jetty_version = "v8.1.0"
|
7
7
|
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
9
|
+
spec.rspec_opts = ['--backtrace'] if ENV['CI']
|
10
|
+
end
|
9
11
|
|
10
12
|
desc 'Spin up hydra-jetty and run specs'
|
11
13
|
task ci: ['engine_cart:clean', 'engine_cart:generate', 'jetty:clean'] do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-collections
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carolyn Cole
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hydra-head
|