sufia 7.0.0.beta2 → 7.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/sufia/admin/stats_behavior.rb +1 -0
  3. data/app/controllers/concerns/sufia/batch_uploads_controller_behavior.rb +1 -7
  4. data/app/controllers/concerns/sufia/works_controller_behavior.rb +1 -5
  5. data/app/forms/sufia/forms/collection_form.rb +8 -3
  6. data/app/helpers/sufia/sufia_helper_behavior.rb +10 -10
  7. data/app/models/concerns/sufia/ability.rb +8 -11
  8. data/app/models/concerns/sufia/file_set_behavior.rb +5 -0
  9. data/app/models/featured_work.rb +1 -1
  10. data/app/models/featured_work_list.rb +9 -6
  11. data/app/search_builders/sufia/homepage_search_builder.rb +6 -1
  12. data/app/search_builders/sufia/my_collections_search_builder.rb +4 -9
  13. data/app/search_builders/sufia/my_works_search_builder.rb +6 -5
  14. data/app/search_builders/sufia/search_builder.rb +0 -7
  15. data/app/views/_toolbar.html.erb +13 -29
  16. data/app/views/admin/_menu.html.erb +8 -0
  17. data/app/views/collections/_document_list.html.erb +1 -1
  18. data/app/views/collections/_edit_actions.html.erb +4 -3
  19. data/app/views/collections/_form.html.erb +18 -4
  20. data/app/views/collections/_media_display.html.erb +3 -1
  21. data/app/views/collections/_show_actions.html.erb +19 -5
  22. data/app/views/collections/_show_document_list_menu.html.erb +5 -5
  23. data/app/views/collections/_show_document_list_row.html.erb +3 -3
  24. data/app/views/collections/_work_action_menu.html.erb +4 -4
  25. data/app/views/collections/edit.html.erb +2 -2
  26. data/app/views/collections/show.html.erb +23 -26
  27. data/app/views/curation_concerns/base/_form_metadata.html.erb +1 -1
  28. data/app/views/curation_concerns/base/_form_relationships.html.erb +1 -1
  29. data/app/views/curation_concerns/base/_guts4form.html.erb +3 -1
  30. data/app/views/curation_concerns/file_sets/_descriptions.html.erb +1 -1
  31. data/app/views/curation_concerns/file_sets/edit.html.erb +1 -1
  32. data/app/views/curation_concerns/permissions/confirm.html.erb +1 -1
  33. data/app/views/dashboard/_index_partials/_contents.html.erb +1 -1
  34. data/app/views/dashboard/_index_partials/_proxy_rights.html.erb +3 -3
  35. data/app/views/dashboard/_index_partials/_transfers.html.erb +2 -2
  36. data/app/views/my/_collection_action_menu.html.erb +7 -7
  37. data/app/views/my/_index_partials/_default_group.html.erb +5 -5
  38. data/app/views/my/_index_partials/_list_collections.html.erb +13 -13
  39. data/app/views/my/_index_partials/_list_works.html.erb +2 -2
  40. data/app/views/my/_work_action_menu.html.erb +11 -8
  41. data/app/views/sufia/homepage/_featured.html.erb +4 -4
  42. data/app/views/sufia/homepage/_featured_fields.html.erb +2 -2
  43. data/app/views/sufia/homepage/_recent_document.html.erb +1 -1
  44. data/app/views/sufia/homepage/_sortable_featured.html.erb +7 -7
  45. data/app/views/transfers/index.html.erb +3 -3
  46. data/app/views/users/_contributions.html.erb +2 -2
  47. data/app/views/users/_trophy_edit.html.erb +1 -1
  48. data/config/locales/sufia.en.yml +82 -25
  49. data/config/routes.rb +3 -7
  50. data/lib/generators/sufia/assets_generator.rb +4 -0
  51. data/lib/generators/sufia/install_generator.rb +15 -2
  52. data/lib/generators/sufia/templates/sufia.scss +5 -0
  53. data/lib/generators/sufia/upgrade700_generator.rb +0 -8
  54. data/lib/sufia/version.rb +1 -1
  55. data/spec/controllers/admin_stats_controller_spec.rb +17 -10
  56. data/spec/controllers/generic_works_controller_spec.rb +2 -2
  57. data/spec/features/collection_spec.rb +3 -3
  58. data/spec/features/edit_file_spec.rb +5 -3
  59. data/spec/forms/sufia/collection_form_spec.rb +12 -3
  60. data/spec/models/ability_spec.rb +2 -0
  61. data/spec/models/featured_work_list_spec.rb +6 -6
  62. data/spec/presenters/work_usage_spec.rb +1 -1
  63. data/spec/search_builder/sufia/my_shares_search_builder_spec.rb +4 -2
  64. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  65. data/spec/views/_toolbar.html.erb_spec.rb +11 -0
  66. data/spec/views/collections/_form.html.erb_spec.rb +1 -1
  67. data/spec/views/collections/_show_document_list_menu.html.erb_spec.rb +5 -5
  68. data/spec/views/collections/edit.html.erb_spec.rb +24 -0
  69. data/spec/views/collections/show.html.erb_spec.rb +32 -0
  70. data/spec/views/curation_concerns/base/_form.html.erb_spec.rb +2 -0
  71. data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +1 -8
  72. data/spec/views/my/_list_collections.html.erb_spec.rb +37 -0
  73. data/spec/views/my/_list_works.html.erb_spec.rb +1 -1
  74. data/spec/views/sufia/batch_uploads/_form.html.erb_spec.rb +2 -0
  75. data/sufia.gemspec +1 -1
  76. metadata +11 -6
  77. data/lib/generators/sufia/admin_stat_generator.rb +0 -14
  78. data/lib/generators/sufia/templates/sufia/stats_admin.rb +0 -10
@@ -1,26 +1,26 @@
1
- <% featured = f.object.generic_work_solr_document %>
2
- <li class="dd-item dd3-item featured-item" data-id="<%= featured.id %>">
1
+ <% presenter = f.object.presenter %>
2
+ <li class="dd-item dd3-item featured-item" data-id="<%= presenter.id %>">
3
3
  <div class="dd-handle dd3-handle"><%= t :drag %></div>
4
4
  <div class="dd3-content panel panel-default">
5
5
  <%= f.hidden_field :id %>
6
- <%= f.hidden_field :order, data: {property: "order"} %>
6
+ <%= f.hidden_field :order, data: { property: "order" } %>
7
7
  <div class="main row">
8
8
  <div class="col-sm-3">
9
- <%= link_to curation_concerns_generic_work_path(featured) do %>
10
- <%= render_thumbnail_tag featured, {width: 90} %>
9
+ <%= link_to presenter do %>
10
+ <%= render_thumbnail_tag presenter, width: 90 %>
11
11
  <% end %>
12
12
  </div>
13
13
  <div class="col-sm-9">
14
14
  <% if can? :destroy, FeaturedWork %>
15
15
  <h3 class="pull-right">
16
- <%= link_to sufia.featured_work_path(featured, format: :json),
16
+ <%= link_to sufia.featured_work_path(presenter, format: :json),
17
17
  title: "Remove work from feature section",
18
18
  data: {behavior: 'unfeature'} do %>
19
19
  <i class='glyphicon glyphicon-remove'></i>
20
20
  <% end %>
21
21
  </h3>
22
22
  <% end %>
23
- <%= render partial: 'sufia/homepage/featured_fields', locals: {featured: featured} %>
23
+ <%= render 'sufia/homepage/featured_fields', featured: presenter %>
24
24
  </div>
25
25
  </div>
26
26
  </div>
@@ -1,7 +1,7 @@
1
- <h1>Transfer of Ownership</h1>
1
+ <h1><%= t("sufia.dashboard.transfer_of_ownership") %></h1>
2
2
 
3
- <h2>Sent</h2>
3
+ <h2><%= t("sufia.dashboard.transfers_sent") %></h2>
4
4
  <%= render_sent_transfers %>
5
5
 
6
- <h2>Received</h2>
6
+ <h2><%= t("sufia.dashboard.transfers_received") %></h2>
7
7
  <%= render_received_transfers %>
@@ -4,12 +4,12 @@
4
4
  <% @trophies.each do |t| %>
5
5
  <tr id="trophyrow_<%= t.id %>">
6
6
  <td>
7
- <%= link_to curation_concerns_generic_work_path(t) do %>
7
+ <%= link_to t do %>
8
8
  <%= image_tag t.indexing_service.thumbnail_path, { width: 90 } %>
9
9
  <% end %>
10
10
  </td>
11
11
  <td>
12
- <%= link_to t.to_s, curation_concerns_generic_work_path(t) %>
12
+ <%= link_to t.to_s, t %>
13
13
  <% if current_user == @user %>
14
14
  <%= display_trophy_link current_user, t.id, class: 'glyphicon glyphicon-star', data: {removerow: true} do %>
15
15
  <i class='trophy-on glyphicon glyphicon-remove'></i>
@@ -6,7 +6,7 @@
6
6
  <dl>
7
7
  <% trophies.each do |t| %>
8
8
  <dd>
9
- <%= link_to t, curation_concerns_generic_work_path(t) %>
9
+ <%= link_to t, t %>
10
10
  <label class="checkbox fleft">
11
11
  <%= check_box_tag "remove_trophy_#{t.id}" %> Yes &nbsp;
12
12
  </label>
@@ -73,6 +73,25 @@ en:
73
73
  details: 'Details'
74
74
  tab_label: 'Recently Uploaded'
75
75
  no_public: 'No public work has been contributed.'
76
+ toolbar:
77
+ admin:
78
+ menu: "Admin"
79
+ statistics: "Repository Statistics"
80
+ dashboard:
81
+ menu: "Dashboard"
82
+ my: "My Dashboard"
83
+ highlights: "Highlights"
84
+ transfers: "Transfers"
85
+ shares: "Shares"
86
+ works:
87
+ menu: "Works"
88
+ new: "New"
89
+ my: "My Works"
90
+ batch: "Batch Create"
91
+ collections:
92
+ menu: "Collections"
93
+ my: "My Collections"
94
+ new: "New Collection"
76
95
  dashboard:
77
96
  title: "My Dashboard"
78
97
  view_collections: "View Collections"
@@ -85,8 +104,14 @@ en:
85
104
  user_notifications: "User Notifications"
86
105
  no_notifications: "User has no notifications"
87
106
  additional_notifications: "See all notifications"
107
+ manage_proxies: "Manage Proxies"
88
108
  proxy_activity: "Proxy Activity"
109
+ authorize_proxies: "Authorize Proxies"
110
+ current_proxies: "Current Proxies"
111
+ proxy_user: "Proxy User"
89
112
  transfer_of_ownership: "Transfer of Ownership"
113
+ transfers_sent: "Sent"
114
+ transfers_received: "Received"
90
115
  transfer_works_link: "Select works to transfer"
91
116
  no_transfer_requests: "You haven't received any work transfer requests"
92
117
  no_transfers: "You haven't transferred any work"
@@ -110,10 +135,32 @@ en:
110
135
  shared: "Filter your shares"
111
136
  works: "Filter your works"
112
137
  sr:
113
- show_label: "Display all details of"
114
- detail_label: "Display summary details of"
115
- batch_checkbox: "Check to add to a collection or edit list"
116
- check_all_label: "Select all files to be added to a collection or edited"
138
+ show_label: "Display all details of"
139
+ detail_label: "Display summary details of"
140
+ batch_checkbox: "Check to add to a collection or edit list"
141
+ check_all_label: "Select all files to be added to a collection or edited"
142
+ listing: "Listing of items you have deposited in"
143
+ press_to: "Press to"
144
+ heading:
145
+ title: "Title"
146
+ date_uploaded: "Date Uploaded"
147
+ visibility: "Visibility"
148
+ action: "Action"
149
+ collection_list:
150
+ description: "Description:"
151
+ edit_access: "Edit Access:"
152
+ groups: "Groups:"
153
+ users: "Users:"
154
+ action:
155
+ select: "Select an action"
156
+ edit_collection: "Edit Collection"
157
+ delete_collection: "Delete Collection"
158
+ edit_work: "Edit Work"
159
+ delete_work: "Delete Work"
160
+ transfer: "Transfer Ownership of Work"
161
+ work_confirmation: "Deleting a work from %{application_name} is permanent. Click OK to delete this work from %{application_name}, or Cancel to cancel this operation"
162
+ collection_confirmation: "Deleting a collection from %{application_name} is permanent. Click OK to delete this collection from %{application_name}, or Cancel to cancel this operation"
163
+
117
164
  messages:
118
165
  success:
119
166
  single: "has been saved."
@@ -160,8 +207,17 @@ en:
160
207
  generic_works:
161
208
  new:
162
209
  header: Add New Work
210
+ in_collections: This Work in Collections
211
+ after_create_html: "Your files are being processed by %{application_name} in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh this page to see these updates."
163
212
  edit:
164
213
  header: Edit Work
214
+ in_collections: This Work in Collections
215
+ additional_fields: "Additional fields"
216
+ tab:
217
+ metadata: "Descriptions"
218
+ files: "Files"
219
+ relationships: "Relationships"
220
+ share: "Share"
165
221
  progress:
166
222
  header: Save Work
167
223
  show:
@@ -169,15 +225,33 @@ en:
169
225
  batch_uploads:
170
226
  new:
171
227
  header: Batch Create New Works
228
+ in_collections: These Works in Collections
172
229
  progress:
173
230
  header: Save Works
174
231
  files:
175
232
  instructions: Each file will be uploaded to a separate new work resulting in one work per uploaded file.
176
233
  collection:
177
- no_visible_works: "The collection is either empty or does not contain items to which you have access."
178
234
  is_part_of: "Is part of"
179
- add_work: "Add Work"
180
- select_works: "Select Works"
235
+ browse_view: "Browse View"
236
+ actions:
237
+ header: "Actions"
238
+ edit:
239
+ label: "Edit"
240
+ desc: "Edit this collection"
241
+ add_works:
242
+ label: "Add works"
243
+ desc: "Add works to this Collection"
244
+ delete:
245
+ label: "Delete"
246
+ desc: "Delete this collection"
247
+ confirmation: "Delete this collection?"
248
+ edit:
249
+ manage_items: "Manage Items in this Collection"
250
+ description: "Descriptions"
251
+ additional_fields: "Additional fields"
252
+ document_list:
253
+ edit: "Edit"
254
+ no_visible_works: "The collection is either empty or does not contain items to which you have access."
181
255
  select_form:
182
256
  title: "Add to collection"
183
257
  no_collections: "You do not have access to any existing collections. You may create a new collection."
@@ -186,15 +260,6 @@ en:
186
260
  create: "Create Collection"
187
261
  update: "Update Collection"
188
262
  create_new: "Add to new Collection"
189
-
190
- manage_items: "Manage Items in this Collection"
191
- metadata:
192
- add_another_keyword: "add another Keyword"
193
- add_another_creator: "add another Creator"
194
- add_another_rights: "add another Rights"
195
- generic_work:
196
- edit: "Edit"
197
- browse_view: "Browse View"
198
263
  mailbox:
199
264
  date: 'Date'
200
265
  subject: 'Subject'
@@ -269,14 +334,6 @@ en:
269
334
  publisher: "The person or group making the collection available. Generally this is the institution."
270
335
  rights: "Licensing and distribution information governing access to the collection. Select from the provided drop-down list."
271
336
 
272
- aria_label:
273
- upload_set:
274
- default: "Usage information for %{title}"
275
- based_near: "Usage information for location"
276
- description: "Usage information for abstract or summary"
277
- keyword: "Usage information for keyword"
278
- rights: "Usage information for rights"
279
-
280
337
  curation_concerns:
281
338
  base:
282
339
  relationships:
@@ -284,7 +341,7 @@ en:
284
341
  empty: "This %{type} is not currently in any collections."
285
342
  collections: "In collections:"
286
343
  metadata:
287
- header: Metadata
344
+ header: Descriptions
288
345
  attribute_name_label: Attribute Name
289
346
  attribute_values_label: Values
290
347
  items:
data/config/routes.rb CHANGED
@@ -128,7 +128,7 @@ Sufia::Engine.routes.draw do
128
128
 
129
129
  # Permissions routes
130
130
  namespace :curation_concerns, path: :concern do
131
- resources(:permissions, only: []) do
131
+ resources :permissions, only: [] do
132
132
  member do
133
133
  get :confirm
134
134
  post :copy
@@ -150,12 +150,8 @@ Sufia::Engine.routes.draw do
150
150
  end
151
151
  end
152
152
 
153
- if defined?(Sufia::StatsAdmin)
154
- namespace :admin do
155
- constraints Sufia::StatsAdmin do
156
- get 'stats' => 'stats#index', as: :stats
157
- end
158
- end
153
+ namespace :admin do
154
+ get 'stats' => 'stats#index', as: :stats
159
155
  end
160
156
 
161
157
  resources :content_blocks, only: ['create', 'update']
@@ -8,6 +8,10 @@ class Sufia::AssetsGenerator < Rails::Generators::Base
8
8
 
9
9
  source_root File.expand_path('../templates', __FILE__)
10
10
 
11
+ def remove_blacklight_css
12
+ remove_file "app/assets/stylesheets/blacklight.scss"
13
+ end
14
+
11
15
  def inject_css
12
16
  copy_file "sufia.scss", "app/assets/stylesheets/sufia.scss"
13
17
  end
@@ -23,8 +23,10 @@ module Sufia
23
23
  4. Adds controller behavior to the application controller
24
24
  5. Copies the catalog controller into the local app
25
25
  6. Adds Sufia::SolrDocumentBehavior to app/models/solr_document.rb
26
- 7. Updates simple_form to use browser validations
27
- 8. Installs Blacklight gallery
26
+ 7. Installs sufia assets
27
+ 8. Installs hydra:batch_edit
28
+ 9. Updates simple_form to use browser validations
29
+ 10. Installs Blacklight gallery (and removes it's scss)
28
30
  """
29
31
 
30
32
  def banner
@@ -205,6 +207,14 @@ module Sufia
205
207
  generate "sufia:upgrade700"
206
208
  end
207
209
 
210
+ def install_assets
211
+ generate "sufia:assets"
212
+ end
213
+
214
+ def install_batch_edit
215
+ generate "hydra_batch_edit:install"
216
+ end
217
+
208
218
  def use_browser_validations
209
219
  gsub_file 'config/initializers/simple_form.rb',
210
220
  /browser_validations = false/,
@@ -213,6 +223,9 @@ module Sufia
213
223
 
214
224
  def install_blacklight_gallery
215
225
  generate "blacklight_gallery:install"
226
+ # This was pulling in an extra copy of bootstrap, so we added the needed
227
+ # includes to sufia.scss
228
+ remove_file 'app/assets/stylesheets/blacklight_gallery.css.scss'
216
229
  end
217
230
  end
218
231
  end
@@ -6,5 +6,10 @@
6
6
 
7
7
  @import "bootstrap-sprockets";
8
8
  @import 'bootstrap';
9
+ @import 'blacklight/blacklight';
9
10
  @import "font-awesome";
11
+ @import "blacklight_gallery/gallery";
12
+ @import "blacklight_gallery/masonry";
13
+ @import "blacklight_gallery/slideshow";
14
+ @import "blacklight_gallery/osd_viewer";
10
15
  @import 'sufia/sufia';
@@ -45,12 +45,4 @@ This generator for upgrading sufia from 6.0.0 to 7.0 makes the following changes
45
45
  puts " \e[31mFailure\e[0m Sufia requires a CurationConcerns::GenericWorksController object. This generator assumes that the model is defined in the file #{file_path}, which does not exist."
46
46
  end
47
47
  end
48
-
49
- def install_assets
50
- generate "sufia:assets"
51
- end
52
-
53
- def install_batch_edit
54
- generate "hydra_batch_edit:install"
55
- end
56
48
  end
data/lib/sufia/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sufia
2
- VERSION = "7.0.0.beta2".freeze
2
+ VERSION = "7.0.0.beta3".freeze
3
3
  end
@@ -1,20 +1,27 @@
1
1
  describe Admin::StatsController, type: :controller do
2
- let(:user1) { create(:user) }
2
+ let(:user) { create(:user) }
3
3
 
4
- before do
5
- allow(user1).to receive(:groups).and_return(['admin'])
4
+ context "a non admin" do
5
+ describe "#index" do
6
+ it 'is unauthorized' do
7
+ get :index
8
+ expect(response).to be_redirect
9
+ end
10
+ end
6
11
  end
7
12
 
8
- describe "#index" do
13
+ context "as an admin" do
9
14
  before do
10
- sign_in user1
15
+ allow(controller).to receive(:authorize!).and_return(true)
11
16
  end
12
17
 
13
- it 'allows an authorized user to view the page' do
14
- expect(Sufia::AdminStatsPresenter).to receive(:new).with({}, 5).and_call_original
15
- get :index
16
- expect(response).to be_success
17
- expect(assigns[:presenter]).to be_kind_of Sufia::AdminStatsPresenter
18
+ describe "#index" do
19
+ it 'allows an authorized user to view the page' do
20
+ expect(Sufia::AdminStatsPresenter).to receive(:new).with({}, 5).and_call_original
21
+ get :index
22
+ expect(response).to be_success
23
+ expect(assigns[:presenter]).to be_kind_of Sufia::AdminStatsPresenter
24
+ end
18
25
  end
19
26
  end
20
27
  end
@@ -106,7 +106,7 @@ describe CurationConcerns::GenericWorksController do
106
106
  post :create, generic_work: { title: ["First title"],
107
107
  visibility: 'open' },
108
108
  uploaded_files: ['777', '888']
109
- expect(flash[:notice]).to eq "Your files are being processed by Sufia in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh your dashboard to see these updates."
109
+ expect(flash[:notice]).to eq "Your files are being processed by Sufia in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh this page to see these updates."
110
110
  expect(response).to redirect_to main_app.curation_concerns_generic_work_path(work)
111
111
  end
112
112
 
@@ -156,7 +156,7 @@ describe CurationConcerns::GenericWorksController do
156
156
  uploaded_files: uploaded_files,
157
157
  parent_id: work.id,
158
158
  generic_work: { title: ['First title'] }
159
- expect(flash[:notice]).to eq "Your files are being processed by Sufia in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh your dashboard to see these updates."
159
+ expect(flash[:notice]).to eq "Your files are being processed by Sufia in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh this page to see these updates."
160
160
  expect(response).to redirect_to main_app.curation_concerns_generic_work_path(work)
161
161
  end
162
162
  end
@@ -18,7 +18,7 @@ describe 'collection', type: :feature do
18
18
  visit '/dashboard'
19
19
  first('#hydra-collection-add').click
20
20
  expect(page).to have_content 'Create New Collection'
21
-
21
+ click_link('Additional fields')
22
22
  # Creator is a multi-value field, so it should have button to add more fields
23
23
  expect(page).to have_selector "div.collection_creator .input-append button.add"
24
24
 
@@ -176,14 +176,14 @@ describe 'collection', type: :feature do
176
176
 
177
177
  it "preselects the collection we are adding works to" do
178
178
  visit "/collections/#{collection1.id}"
179
- click_link 'Add files'
179
+ click_link 'Add works'
180
180
  first('input#check_all').click
181
181
  click_button "Add to Collection"
182
182
  expect(page).to have_css("input#id_#{collection1.id}[checked='checked']")
183
183
  expect(page).not_to have_css("input#id_#{collection2.id}[checked='checked']")
184
184
 
185
185
  visit "/collections/#{collection2.id}"
186
- click_link 'Add files'
186
+ click_link 'Add works'
187
187
  first('input#check_all').click
188
188
  click_button "Add to Collection"
189
189
  expect(page).not_to have_css("input#id_#{collection1.id}[checked='checked']")
@@ -2,17 +2,19 @@ describe "Editing a file:", type: :feature do
2
2
  let(:user) { create(:user) }
3
3
  let(:file_title) { 'Some kind of title' }
4
4
  let(:work) { build(:work, user: user) }
5
- let(:file) { work.members.first }
5
+ let(:file_set) { create(:file_set, user: user, title: [file_title]) }
6
+ let(:file) { File.open(fixture_path + '/world.png') }
6
7
 
7
8
  before do
8
9
  sign_in user
9
- work.ordered_members << create(:file_set, user: user, title: [file_title])
10
+ Hydra::Works::AddFileToFileSet.call(file_set, file, :original_file)
11
+ work.ordered_members << file_set
10
12
  work.save!
11
13
  end
12
14
 
13
15
  context 'when the user tries to update file content, but forgets to select a file:' do
14
16
  it 'shows the edit page again' do
15
- visit edit_curation_concerns_file_set_path(file)
17
+ visit edit_curation_concerns_file_set_path(file_set)
16
18
  click_link 'Versions'
17
19
  click_button 'Upload New Version'
18
20
  expect(page).to have_content "Edit #{file_title}"