hydra-collections 7.0.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/Changelog.md +5 -4
  4. data/Gemfile +2 -1
  5. data/README.md +2 -11
  6. data/app/controllers/concerns/hydra/collections_controller_behavior.rb +18 -8
  7. data/app/helpers/collections_helper.rb +6 -2
  8. data/app/models/concerns/hydra/collections/metadata.rb +2 -2
  9. data/app/views/collections/_button_remove_from_collection.html.erb +4 -6
  10. data/app/views/collections/_document_header.html.erb +1 -4
  11. data/app/views/collections/_form.html.erb +7 -7
  12. data/app/views/collections/_search_form.html.erb +4 -4
  13. data/app/views/collections/show.html.erb +29 -5
  14. data/app/views/layouts/collections.html.erb +0 -1
  15. data/hydra-collections.gemspec +1 -0
  16. data/lib/hydra-collections.rb +0 -1
  17. data/lib/hydra/collections/version.rb +1 -1
  18. data/solr/config/_rest_managed.json +3 -0
  19. data/solr/config/admin-extra.html +31 -0
  20. data/solr/config/elevate.xml +36 -0
  21. data/solr/config/mapping-ISOLatin1Accent.txt +246 -0
  22. data/solr/config/protwords.txt +21 -0
  23. data/solr/config/schema.xml +372 -0
  24. data/solr/config/scripts.conf +24 -0
  25. data/solr/config/solrconfig.xml +300 -0
  26. data/solr/config/spellings.txt +2 -0
  27. data/solr/config/stopwords.txt +58 -0
  28. data/solr/config/stopwords_en.txt +58 -0
  29. data/solr/config/synonyms.txt +31 -0
  30. data/solr/config/xslt/example.xsl +132 -0
  31. data/solr/config/xslt/example_atom.xsl +67 -0
  32. data/solr/config/xslt/example_rss.xsl +66 -0
  33. data/solr/config/xslt/luke.xsl +337 -0
  34. data/spec/controllers/catalog_controller_spec.rb +6 -14
  35. data/spec/controllers/collections_controller_spec.rb +67 -61
  36. data/spec/controllers/other_collections_controller_spec.rb +1 -1
  37. data/spec/controllers/selects_collections_spec.rb +33 -33
  38. data/spec/factories.rb +10 -1
  39. data/spec/factories/users.rb +1 -11
  40. data/spec/features/create_collection_spec.rb +17 -0
  41. data/spec/helpers/collections_helper_spec.rb +44 -35
  42. data/spec/models/collection_spec.rb +8 -10
  43. data/spec/spec_helper.rb +9 -0
  44. data/spec/test_app_templates/app/views/catalog/_sort_and_per_page.html.erb +2 -3
  45. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -4
  46. data/spec/views/collections/_form.html.erb_spec.rb +15 -0
  47. data/spec/views/collections/show.html.erb_spec.rb +1 -1
  48. data/tasks/hydra-collections-dev.rake +6 -6
  49. metadata +37 -14
  50. data/app/helpers/collections_search_helper.rb +0 -11
  51. data/app/models/concerns/hydra/collections/actions.rb +0 -22
  52. data/config/jetty.yml +0 -6
  53. data/lib/hydra/collections/collectible.rb +0 -25
  54. data/spec/helpers/collections_search_helper_spec.rb +0 -16
  55. data/spec/lib/collectible_spec.rb +0 -39
  56. data/spec/test_app_templates/config/blacklight.yml +0 -22
  57. data/tasks/jetty.rake +0 -40
@@ -1,28 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe CatalogController, :type => :controller do
4
-
5
4
  before do
6
5
  allow(controller).to receive(:has_access?).and_return(true)
7
- @user = FactoryGirl.find_or_create(:user)
8
- @collection = Collection.new title: "Test"
9
- @collection.apply_depositor_metadata(@user.user_key)
10
- @collection.read_groups = ["public"]
11
- @collection.save!
12
6
  end
13
7
 
14
- after do
15
- @collection.destroy
16
- end
17
-
8
+ let(:user) { FactoryGirl.create(:user) }
9
+ let!(:collection) { FactoryGirl.create(:collection, user: user, read_groups: ['public']) }
10
+
18
11
  routes { Rails.application.routes }
19
-
12
+
20
13
  describe '#index' do
21
- it 'should assign @user_collections' do
14
+ it 'assigns @user_collections' do
22
15
  get :index
23
16
  expect(assigns(:user_collections)).to be_kind_of(Array)
24
- expect(assigns(:user_collections).index{|d| d.id == @collection.id}).not_to be_nil
17
+ expect(assigns(:user_collections).map(&:id)).to include collection.id
25
18
  end
26
19
  end
27
-
28
20
  end
@@ -39,8 +39,8 @@ describe CollectionsController, :type => :controller do
39
39
  end
40
40
 
41
41
  describe "#index" do
42
- let!(:collection1) { Collection.create(title: 'Beta') { |c| c.apply_depositor_metadata(user.user_key) } }
43
- let!(:collection2) { Collection.create(title: 'Alpha') { |c| c.apply_depositor_metadata(user.user_key) } }
42
+ let!(:collection1) { FactoryGirl.create(:collection, title: ['Beta'], user: user) }
43
+ let!(:collection2) { FactoryGirl.create(:collection, title: ['Alpha'], user: user) }
44
44
  let!(:generic_file) { GenericWork.create }
45
45
 
46
46
  it "shows a list of collections sorted alphabetically" do
@@ -52,49 +52,60 @@ describe CollectionsController, :type => :controller do
52
52
  end
53
53
 
54
54
  describe '#new' do
55
- it 'should assign @collection' do
55
+ it 'assigns @collection' do
56
56
  get :new
57
57
  expect(assigns(:collection)).to be_kind_of(Collection)
58
58
  end
59
59
  end
60
60
 
61
61
  describe '#create' do
62
- it "should create a Collection" do
62
+ it "creates a Collection" do
63
63
  expect {
64
- post :create, collection: {title: "My First Collection ", description: "The Description\r\n\r\nand more"}
64
+ post :create, collection: { title: ["My First Collection"],
65
+ description: ["The Description\r\n\r\nand more"] }
65
66
  }.to change { Collection.count }.by(1)
66
- expect(assigns[:collection].title).to eq("My First Collection ")
67
- expect(assigns[:collection].description).to eq("The Description\r\n\r\nand more")
67
+ expect(assigns[:collection].title).to eq ["My First Collection"]
68
+ expect(assigns[:collection].description).to eq ["The Description\r\n\r\nand more"]
68
69
  expect(assigns[:collection].depositor).to eq(user.user_key)
69
70
  expect(response).to redirect_to collections.collection_path(assigns[:collection])
70
71
  end
71
- it "should add docs to collection if batch ids provided" do
72
+
73
+ it "adds docs to collection if batch ids provided" do
72
74
  @asset1 = GenericWork.create!
73
75
  @asset2 = GenericWork.create!
74
- post :create, batch_document_ids: [@asset1, @asset2], collection: {title: "My Secong Collection ", description: "The Description\r\n\r\nand more"}
75
- expect(assigns[:collection].members).to eq([@asset1, @asset2])
76
+ post :create, batch_document_ids: [@asset1, @asset2],
77
+ collection: { title: ["My Secong Collection"],
78
+ description: ["The Description\r\n\r\nand more"] }
79
+ expect(assigns[:collection].members).to eq [@asset1, @asset2]
76
80
  end
77
- it "should call after_create" do
81
+
82
+ it "calls after_create" do
78
83
  expect(controller).to receive(:after_create).and_call_original
79
- post :create, collection: {title: "My First Collection ", description: "The Description\r\n\r\nand more"}
84
+ post :create, collection: { title: ["My First Collection"],
85
+ description: ["The Description\r\n\r\nand more"] }
80
86
  end
81
87
 
82
- it "should add one doc to collection if batch ids provided and add the collection id to the document in the colledction" do
88
+ it "adds one doc to collection if batch ids provided and add the collection id to the document in the colledction" do
83
89
  @asset1 = GenericWork.create!
84
- post :create, batch_document_ids: [@asset1], collection: {title: "My Secong Collection ", description: "The Description\r\n\r\nand more"}
90
+ post :create, batch_document_ids: [@asset1],
91
+ collection: { title: ["My Secong Collection"],
92
+ description: ["The Description\r\n\r\nand more"] }
85
93
  expect(assigns[:collection].members).to eq [@asset1]
86
94
  asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
87
95
  expect(asset_results["response"]["numFound"]).to eq(1)
88
96
  doc = asset_results["response"]["docs"].first
89
- expect(doc["id"]).to eq(@asset1.id)
97
+ expect(doc["id"]).to eq @asset1.id
90
98
  afterupdate = GenericWork.find(@asset1.id)
91
99
  expect(doc[Solrizer.solr_name(:collection)]).to eq(afterupdate.to_solr[Solrizer.solr_name(:collection)])
92
100
  end
93
- it "should add docs to collection if batch ids provided and add the collection id to the documents int he colledction" do
101
+
102
+ it "adds docs to collection if batch ids provided and add the collection id to the documents int he colledction" do
94
103
  @asset1 = GenericWork.create!
95
104
  @asset2 = GenericWork.create!
96
- post :create, batch_document_ids: [@asset1,@asset2], collection: {title: "My Secong Collection ", description: "The Description\r\n\r\nand more"}
97
- expect(assigns[:collection].members).to eq([@asset1,@asset2])
105
+ post :create, batch_document_ids: [@asset1, @asset2],
106
+ collection: { title: ["My Secong Collection"],
107
+ description: ["The Description\r\n\r\nand more"] }
108
+ expect(assigns[:collection].members).to eq [@asset1, @asset2]
98
109
  asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
99
110
  expect(asset_results["response"]["numFound"]).to eq(1)
100
111
  doc = asset_results["response"]["docs"].first
@@ -105,8 +116,8 @@ describe CollectionsController, :type => :controller do
105
116
  end
106
117
 
107
118
  describe "#update" do
119
+ let(:collection) { FactoryGirl.create(:collection, user: user) }
108
120
  before do
109
- @collection = Collection.create { |c| c.apply_depositor_metadata(user.user_key) }
110
121
  @asset1 = GenericWork.create!
111
122
  @asset2 = GenericWork.create!
112
123
  @asset3 = GenericWork.create!
@@ -114,16 +125,16 @@ describe CollectionsController, :type => :controller do
114
125
  expect(controller).to receive(:authorize!).at_least(:once)
115
126
  end
116
127
 
117
- it "should update collection metadata" do
118
- put :update, id: @collection.id, collection: { title: "New Title", description: "New Description" }
119
- expect(response).to redirect_to collections.collection_path(@collection)
120
- expect(assigns[:collection].title).to eq("New Title")
121
- expect(assigns[:collection].description).to eq("New Description")
128
+ it "updates collection metadata" do
129
+ put :update, id: collection.id, collection: { title: ["New Title"], description: ["New Description"] }
130
+ expect(response).to redirect_to collections.collection_path(collection)
131
+ expect(assigns[:collection].title).to eq(["New Title"])
132
+ expect(assigns[:collection].description).to eq(["New Description"])
122
133
  end
123
134
 
124
- it "should call after_update" do
135
+ it "calls after_update" do
125
136
  expect(controller).to receive(:after_update).and_call_original
126
- put :update, id: @collection.id, collection: { title: "New Title", description: "New Description" }
137
+ put :update, id: collection.id, collection: { title: ["New Title"], description: ["New Description"] }
127
138
  end
128
139
 
129
140
  context "when updating fails" do
@@ -131,49 +142,49 @@ describe CollectionsController, :type => :controller do
131
142
  allow_any_instance_of(Collection).to receive(:save).and_return(false)
132
143
  end
133
144
  it "should render edit succesfully" do
134
- put :update, id: @collection.id, collection: { title: "New Title" }
145
+ put :update, id: collection.id, collection: { title: ["New Title"] }
135
146
  expect(response).to render_template "edit"
136
147
  end
137
148
  end
138
149
 
139
150
  context "when there are existing members in the collection" do
140
151
  it "should support adding batches of members" do
141
- @collection.members << @asset1
142
- @collection.save
143
- put :update, id: @collection, collection: { members:"add" }, batch_document_ids: [@asset2, @asset3]
144
- expect(response).to redirect_to collections.collection_path(@collection)
152
+ collection.members << @asset1
153
+ collection.save!
154
+ put :update, id: collection, collection: { members:"add" }, batch_document_ids: [@asset2, @asset3]
155
+ expect(response).to redirect_to collections.collection_path(collection)
145
156
  expect(assigns[:collection].members).to match_array [@asset2, @asset3, @asset1]
146
157
  end
147
158
 
148
159
  it "should support removing batches of members" do
149
- @collection.members = [@asset1, @asset2, @asset3]
150
- @collection.save
151
- put :update, id: @collection, collection: { members: "remove" }, batch_document_ids: [@asset1, @asset3]
152
- expect(response).to redirect_to collections.collection_path(@collection)
160
+ collection.members = [@asset1, @asset2, @asset3]
161
+ collection.save!
162
+ put :update, id: collection, collection: { members: "remove" }, batch_document_ids: [@asset1, @asset3]
163
+ expect(response).to redirect_to collections.collection_path(collection)
153
164
  expect(assigns[:collection].members).to eq([@asset2])
154
165
  end
155
166
  end
156
167
 
157
168
  it "should support setting members array" do
158
- put :update, id: @collection, collection: { members: "add" }, batch_document_ids: [@asset2, @asset3, @asset1]
159
- expect(response).to redirect_to collections.collection_path(@collection)
169
+ put :update, id: collection, collection: { members: "add" }, batch_document_ids: [@asset2, @asset3, @asset1]
170
+ expect(response).to redirect_to collections.collection_path(collection)
160
171
  expect(assigns[:collection].members).to match_array [@asset2, @asset3, @asset1]
161
172
  end
162
173
 
163
174
  it "should set/un-set collection on members" do
164
175
  # Add to collection (sets collection on members)
165
- put :update, id: @collection, collection: { members: "add" }, batch_document_ids: [@asset2, @asset3]
176
+ put :update, id: collection, collection: { members: "add" }, batch_document_ids: [@asset2, @asset3]
166
177
  expect(assigns[:collection].members).to match_array [@asset2, @asset3]
167
178
 
168
179
  # Remove from collection (un-sets collection on members)
169
- put :update, id: @collection, collection: { members:"remove" }, batch_document_ids: [@asset2]
180
+ put :update, id: collection, collection: { members:"remove" }, batch_document_ids: [@asset2]
170
181
  expect(assigns[:collection].members).to_not include(@asset2)
171
182
  end
172
183
 
173
184
  context "when moving members between collections" do
174
185
  before do
175
- @collection.members = [@asset1, @asset2, @asset3]
176
- @collection.save
186
+ collection.members = [@asset1, @asset2, @asset3]
187
+ collection.save!
177
188
  end
178
189
  let(:collection2) do
179
190
  Collection.create do |col|
@@ -182,9 +193,9 @@ describe CollectionsController, :type => :controller do
182
193
  end
183
194
 
184
195
  it "moves the members" do
185
- put :update, id: @collection, collection: {members: "move"},
196
+ put :update, id: collection, collection: {members: "move"},
186
197
  destination_collection_id: collection2, batch_document_ids: [@asset2, @asset3]
187
- expect(@collection.reload.members).to eq [@asset1]
198
+ expect(collection.reload.members).to eq [@asset1]
188
199
  expect(collection2.reload.members).to match_array [@asset2, @asset3]
189
200
  end
190
201
  end
@@ -192,34 +203,34 @@ describe CollectionsController, :type => :controller do
192
203
 
193
204
  describe "#destroy" do
194
205
  describe "valid collection" do
206
+ let!(:collection) { FactoryGirl.create(:collection, user: user) }
195
207
  before do
196
- @collection = Collection.create { |c| c.apply_depositor_metadata(user.user_key) }
197
208
  expect(controller).to receive(:authorize!).and_return(true)
198
209
  end
199
210
 
200
211
  it "deletes the collection" do
201
- delete :destroy, id: @collection
212
+ delete :destroy, id: collection
202
213
  expect(response).to redirect_to Rails.application.routes.url_helpers.search_catalog_path
203
214
  expect(flash[:notice]).to eq("Collection was successfully deleted.")
204
215
  end
205
216
 
206
217
  it "calls after_destroy" do
207
218
  expect(controller).to receive(:after_destroy).and_call_original
208
- delete :destroy, id: @collection
219
+ delete :destroy, id: collection
209
220
  end
210
221
 
211
222
  it "updates members" do
212
223
  asset1 = GenericWork.create!
213
- @collection.members << asset1
214
- @collection.save!
215
- expect(asset1.in_collections).to eq [@collection]
224
+ collection.members << asset1
225
+ collection.save!
226
+ expect(asset1.in_collections).to eq [collection]
216
227
 
217
- delete :destroy, id: @collection
228
+ delete :destroy, id: collection
218
229
  expect(asset1.in_collections).to eq []
219
230
  end
220
231
  end
221
232
 
222
- it "should not delete an invalid collection" do
233
+ it "does not delete an invalid collection" do
223
234
  expect {delete :destroy, id: 'zz:-1'}.to raise_error
224
235
  end
225
236
  end
@@ -230,11 +241,11 @@ describe CollectionsController, :type => :controller do
230
241
  end
231
242
 
232
243
  context "when there are no assets in the collection" do
233
- let(:collection) { Collection.create(title: "Empty collection") }
244
+ let(:collection) { FactoryGirl.create(:collection) }
234
245
  it "shows no assets" do
235
246
  get :show, id: collection
236
247
  expect(response).to be_successful
237
- expect(assigns[:collection].title).to eq("Empty collection")
248
+ expect(assigns[:collection]).to eq collection
238
249
  expect(assigns[:member_docs]).to be_empty
239
250
  end
240
251
  end
@@ -244,15 +255,12 @@ describe CollectionsController, :type => :controller do
244
255
  let(:asset2) { GenericWork.create!(title: "Second of the Assets", read_users: [user.user_key]) }
245
256
  let(:asset3) { GenericWork.create!(title: "Third of the Assets", read_users: [user.user_key]) }
246
257
  let!(:collection) do
247
- Collection.create!(id: "abc123", title: "My collection",
248
- members: [asset1, asset2, asset3]) do |col|
249
- col.apply_depositor_metadata(user.user_key)
250
- end
258
+ FactoryGirl.create(:collection, members: [asset1, asset2, asset3], user: user)
251
259
  end
252
260
 
253
261
  # NOTE: This test depends on title_tesim being in the qf in solrconfig.xml
254
262
  it "queries the collections" do
255
- get :show, id: collection, cq:"\"#{asset1.title}\""
263
+ get :show, id: collection, cq: "First"
256
264
  expect(assigns[:collection].title).to eq collection.title
257
265
  expect(assigns[:member_docs].map(&:id)).to match_array [asset1.id]
258
266
  end
@@ -266,9 +274,7 @@ describe CollectionsController, :type => :controller do
266
274
  describe "additional collections" do
267
275
  let(:asset4) { GenericWork.create!(title: "#{asset1.id}", read_users: [user.user_key]) }
268
276
  let!(:collection2) do
269
- Collection.create!(id: "abc1234", title: "Other collection", members: [asset4]) do |col|
270
- col.apply_depositor_metadata(user.user_key)
271
- end
277
+ FactoryGirl.create(:collection, members: [asset4], user: user)
272
278
  end
273
279
  it "shows only the collections assets" do
274
280
  get :show, id: collection
@@ -30,7 +30,7 @@ describe OtherCollectionsController, :type => :controller do
30
30
  let(:asset2) { Member.create!(read_users: [user.user_key]) }
31
31
  let(:asset3) { Member.create!(read_users: [user.user_key]) }
32
32
  let(:collection) do
33
- OtherCollection.create(id: 'foo123', title: "My collection",
33
+ OtherCollection.create(id: 'foo123', title: ["My collection"],
34
34
  members: [asset1, asset2, asset3]) do |collection|
35
35
  collection.apply_depositor_metadata(user.user_key)
36
36
  end
@@ -19,37 +19,37 @@ describe SelectsCollectionsController, :type => :controller do
19
19
  end
20
20
 
21
21
  describe "Select Collections" do
22
- before do
23
- @user = FactoryGirl.find_or_create(:user)
24
- @collection = Collection.new title:"Test Public"
25
- @collection.apply_depositor_metadata(@user.user_key)
26
- @collection.read_groups = ["public"]
27
- @collection.save
28
- @collection2 = Collection.new title:"Test Read"
29
- @collection2.apply_depositor_metadata('abc123@test.com')
30
- @collection2.read_users = [@user.user_key]
31
- @collection2.save
32
- @collection3 = Collection.new title:"Test Edit"
33
- @collection3.apply_depositor_metadata('abc123@test.com')
34
- @collection3.edit_users = [@user.user_key]
35
- @collection3.save
36
- @collection4 = Collection.new title:"Test No Access"
37
- @collection4.apply_depositor_metadata('abc123@test.com')
38
- @collection4.save
39
- end
22
+ let(:user) { FactoryGirl.create(:user) }
23
+ let!(:collection) { FactoryGirl.create(:collection, read_groups: ['public'], user: user) }
24
+ let!(:collection2) { FactoryGirl.create(:collection, read_users: [user.user_key]) }
25
+ let!(:collection3) { FactoryGirl.create(:collection, edit_users: [user.user_key]) }
26
+ let!(:collection4) { FactoryGirl.create(:collection) }
27
+ # # collection = Collection.new title:"Test Public"
28
+ # # collection.apply_depositor_metadata(@user.user_key)
29
+ # # collection.read_groups = ["public"]
30
+ # # collection.save
31
+ # collection2 = Collection.new title:"Test Read"
32
+ # collection2.apply_depositor_metadata('abc123@test.com')
33
+ # collection2.read_users = [@user.user_key]
34
+ # collection2.save
35
+ # collection3 = Collection.new title:"Test Edit"
36
+ # collection3.apply_depositor_metadata('abc123@test.com')
37
+ # collection3.edit_users = [@user.user_key]
38
+ # collection3.save
39
+ # collection4 = Collection.new title:"Test No Access"
40
+ # collection4.apply_depositor_metadata('abc123@test.com')
41
+ # collection4.save
40
42
 
41
43
  describe "Public Access" do
42
- it "should only return public collections" do
44
+ it "only returns public collections" do
43
45
  subject.find_collections
44
- expect(assigns[:user_collections].map(&:id)).to match_array [@collection.id]
46
+ expect(assigns[:user_collections].map(&:id)).to match_array [collection.id]
45
47
  end
46
48
 
47
49
  context "when there are more than 10" do
48
50
  before do
49
51
  11.times do |i|
50
- Collection.create(title:"Test Public #{i}", read_groups: ["public"]) do |col|
51
- col.apply_depositor_metadata(@user.user_key)
52
- end
52
+ FactoryGirl.create(:collection, read_groups: ["public"], user: user)
53
53
  end
54
54
  end
55
55
 
@@ -67,33 +67,33 @@ describe SelectsCollectionsController, :type => :controller do
67
67
  end
68
68
  end
69
69
  describe "signed in" do
70
- before { sign_in @user }
70
+ before { sign_in user }
71
71
 
72
- it "should return only public and read access (edit access implies read) collections" do
72
+ it "only returns public and read access (edit access implies read) collections" do
73
73
  subject.find_collections_with_read_access
74
- expect(assigns[:user_collections].map(&:id)).to match_array [@collection.id, @collection2.id, @collection3.id]
74
+ expect(assigns[:user_collections].map(&:id)).to match_array [collection.id, collection2.id, collection3.id]
75
75
  end
76
76
  end
77
77
  end
78
78
 
79
79
  describe "Edit Access" do
80
80
  describe "not signed in" do
81
- it "should error if the user is not signed in" do
81
+ it "errors if the user is not signed in" do
82
82
  expect { subject.find_collections_with_edit_access }.to raise_error
83
83
  end
84
84
  end
85
85
 
86
86
  describe "signed in" do
87
- before { sign_in @user }
87
+ before { sign_in user }
88
88
 
89
- it "returns only public or editable collections" do
89
+ it "only returns public or editable collections" do
90
90
  subject.find_collections_with_edit_access
91
- expect(assigns[:user_collections].map(&:id)).to match_array [@collection.id, @collection3.id]
91
+ expect(assigns[:user_collections].map(&:id)).to match_array [collection.id, collection3.id]
92
92
  end
93
93
 
94
- it "returns only public or editable collections & instructions" do
94
+ it "only returns public or editable collections & instructions" do
95
95
  subject.find_collections_with_edit_access(true)
96
- expect(assigns[:user_collections].map(&:id)).to match_array [-1, @collection.id, @collection3.id]
96
+ expect(assigns[:user_collections].map(&:id)).to match_array [-1, collection.id, collection3.id]
97
97
  end
98
98
 
99
99
  context "after querying for read access" do
@@ -103,7 +103,7 @@ describe SelectsCollectionsController, :type => :controller do
103
103
  end
104
104
 
105
105
  it "returns collections with edit access" do
106
- expect(assigns[:user_collections].map(&:id)).to match_array [@collection.id, @collection3.id]
106
+ expect(assigns[:user_collections].map(&:id)).to match_array [collection.id, collection3.id]
107
107
  end
108
108
  end
109
109
  end
@@ -1,4 +1,13 @@
1
1
  FactoryGirl.define do
2
- factory :collection
2
+ factory :collection do
3
+ transient do
4
+ user { FactoryGirl.create(:user) }
5
+ end
6
+ title ['test collection']
7
+
8
+ after(:build) do |work, evaluator|
9
+ work.apply_depositor_metadata(evaluator.user.user_key)
10
+ end
11
+ end
3
12
  end
4
13