sufia 6.2.0 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +146 -0
  3. data/.travis.yml +4 -7
  4. data/Gemfile +2 -0
  5. data/History.md +29 -1
  6. data/README.md +25 -9
  7. data/SUFIA_VERSION +1 -1
  8. data/app/assets/stylesheets/sufia/_collections.scss +15 -0
  9. data/app/assets/stylesheets/sufia/_file-listing.scss +7 -0
  10. data/app/assets/stylesheets/sufia/_home-page.scss +10 -0
  11. data/app/builders/sufia/bootstrap_breadcrumbs_builder.rb +3 -5
  12. data/app/controllers/admin/stats_controller.rb +1 -76
  13. data/app/controllers/api/items_controller.rb +4 -6
  14. data/app/controllers/api/zotero_controller.rb +5 -5
  15. data/app/controllers/authorities_controller.rb +5 -1
  16. data/app/controllers/batch_edits_controller.rb +3 -3
  17. data/app/controllers/concerns/sufia/admin/depositor_stats.rb +41 -0
  18. data/app/controllers/concerns/sufia/admin/stats_behavior.rb +94 -0
  19. data/app/controllers/concerns/sufia/batch_controller_behavior.rb +16 -18
  20. data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +54 -56
  21. data/app/controllers/concerns/sufia/breadcrumbs.rb +3 -6
  22. data/app/controllers/concerns/sufia/collections_controller_behavior.rb +39 -39
  23. data/app/controllers/concerns/sufia/controller.rb +10 -10
  24. data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +17 -18
  25. data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +9 -12
  26. data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +6 -7
  27. data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +39 -40
  28. data/app/controllers/concerns/sufia/files_controller/upload_complete_behavior.rb +1 -1
  29. data/app/controllers/concerns/sufia/files_controller_behavior.rb +109 -110
  30. data/app/controllers/concerns/sufia/homepage_controller.rb +8 -8
  31. data/app/controllers/concerns/sufia/my_controller_behavior.rb +13 -10
  32. data/app/controllers/concerns/sufia/single_use_links_controller_behavior.rb +11 -14
  33. data/app/controllers/concerns/sufia/single_use_links_viewer_controller_behavior.rb +27 -21
  34. data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +17 -17
  35. data/app/controllers/concerns/sufia/users_controller_behavior.rb +54 -54
  36. data/app/controllers/contact_form_controller.rb +1 -1
  37. data/app/controllers/content_blocks_controller.rb +11 -12
  38. data/app/controllers/directory_controller.rb +2 -3
  39. data/app/controllers/featured_work_lists_controller.rb +1 -1
  40. data/app/controllers/featured_works_controller.rb +2 -4
  41. data/app/controllers/homepage_controller.rb +1 -2
  42. data/app/controllers/mailbox_controller.rb +12 -32
  43. data/app/controllers/my/collections_controller.rb +3 -4
  44. data/app/controllers/my/files_controller.rb +4 -6
  45. data/app/controllers/my/highlights_controller.rb +4 -6
  46. data/app/controllers/my/shares_controller.rb +3 -5
  47. data/app/controllers/pages_controller.rb +1 -3
  48. data/app/controllers/single_use_links_controller.rb +0 -1
  49. data/app/controllers/single_use_links_viewer_controller.rb +0 -1
  50. data/app/controllers/static_controller.rb +1 -0
  51. data/app/forms/sufia/forms/collection_edit_form.rb +2 -2
  52. data/app/helpers/batch_edits_helper.rb +1 -3
  53. data/app/helpers/content_block_helper.rb +7 -8
  54. data/app/helpers/generic_file_helper.rb +23 -24
  55. data/app/helpers/sufia/blacklight_override.rb +6 -7
  56. data/app/helpers/sufia/dashboard_helper_behavior.rb +4 -7
  57. data/app/helpers/sufia/permissions_helper.rb +3 -4
  58. data/app/helpers/sufia/sufia_helper_behavior.rb +30 -29
  59. data/app/helpers/trophy_helper.rb +15 -15
  60. data/app/inputs/select_with_modal_help_input.rb +3 -3
  61. data/app/inputs/with_help_icon.rb +4 -4
  62. data/app/jobs/content_delete_event_job.rb +0 -1
  63. data/app/jobs/content_depositor_change_event_job.rb +1 -2
  64. data/app/jobs/event_job.rb +0 -1
  65. data/app/jobs/user_unfollow_event_job.rb +1 -0
  66. data/app/models/concerns/sufia/solr_document_behavior.rb +1 -2
  67. data/app/models/contact_form.rb +6 -6
  68. data/app/models/content_block.rb +1 -2
  69. data/app/models/featured_work_list.rb +3 -5
  70. data/app/models/user_mailbox.rb +44 -0
  71. data/app/presenters/sufia/collection_presenter.rb +6 -8
  72. data/app/presenters/sufia/generic_file_presenter.rb +2 -2
  73. data/app/presenters/sufia/presenter_renderer.rb +2 -2
  74. data/app/presenters/sufia/version_list_presenter.rb +1 -1
  75. data/app/presenters/sufia/version_presenter.rb +3 -6
  76. data/app/search_builders/deposit_search_builder.rb +19 -0
  77. data/app/search_builders/sufia/my_search_builder_behavior.rb +1 -2
  78. data/app/search_builders/sufia/search_builder.rb +1 -3
  79. data/app/uploaders/tinymce_asset_uploader.rb +0 -2
  80. data/app/views/_controls.html.erb +5 -5
  81. data/app/views/admin/stats/_deposits.html.erb +19 -0
  82. data/app/views/admin/stats/index.html.erb +2 -0
  83. data/app/views/batch_edits/edit.html.erb +2 -2
  84. data/app/views/collections/_edit_actions.html.erb +3 -3
  85. data/app/views/collections/_form_for_select_collection.html.erb +2 -2
  86. data/app/views/collections/_sort_and_per_page.html.erb +12 -9
  87. data/app/views/collections/_view_type_group.html.erb +1 -1
  88. data/app/views/collections/edit.html.erb +5 -5
  89. data/app/views/collections/show.html.erb +7 -6
  90. data/app/views/homepage/_announcement.html.erb +5 -0
  91. data/app/views/homepage/_home.html.erb +1 -0
  92. data/app/views/my/_sort_and_per_page.html.erb +14 -10
  93. data/app/views/my/index.html.erb +1 -1
  94. data/app/views/pages/show.html.erb +0 -2
  95. data/app/views/single_use_links/new_download.html.erb +1 -1
  96. data/app/views/single_use_links_viewer/show.html.erb +1 -1
  97. data/app/views/users/_notify_link.html.erb +1 -1
  98. data/app/views/users/_notify_number.html.erb +2 -2
  99. data/config/initializers/simple_form.rb +1 -1
  100. data/config/initializers/simple_form_bootstrap.rb +1 -1
  101. data/config/locales/sufia.en.yml +4 -0
  102. data/config/routes.rb +2 -3
  103. data/lib/generators/sufia/admin_stat_generator.rb +0 -3
  104. data/lib/generators/sufia/install_generator.rb +8 -9
  105. data/lib/generators/sufia/templates/catalog_controller.rb +2 -3
  106. data/lib/generators/sufia/templates/config/action_dispatch_http_upload_monkey_patch.rb +1 -0
  107. data/lib/generators/sufia/upgrade400_generator.rb +9 -9
  108. data/lib/generators/sufia/upgrade600_generator.rb +1 -4
  109. data/lib/sufia.rb +2 -2
  110. data/lib/sufia/arkivo/actor.rb +1 -1
  111. data/lib/sufia/arkivo/create_subscription_job.rb +30 -30
  112. data/lib/sufia/arkivo/metadata_munger.rb +7 -7
  113. data/lib/sufia/arkivo/schema_validator.rb +1 -1
  114. data/lib/sufia/single_use_error.rb +0 -1
  115. data/lib/sufia/version.rb +1 -1
  116. data/lib/sufia/zotero/config.rb +13 -13
  117. data/spec/actors/generic_file/actor_spec.rb +17 -18
  118. data/spec/controllers/admin_stats_controller_spec.rb +56 -5
  119. data/spec/controllers/api/zotero_controller_spec.rb +10 -9
  120. data/spec/controllers/authorities_controller_spec.rb +8 -8
  121. data/spec/controllers/batch_controller_spec.rb +19 -20
  122. data/spec/controllers/batch_edits_controller_spec.rb +8 -9
  123. data/spec/controllers/catalog_controller_spec.rb +7 -9
  124. data/spec/controllers/collections_controller_spec.rb +30 -32
  125. data/spec/controllers/content_blocks_controller_spec.rb +4 -4
  126. data/spec/controllers/dashboard_controller_spec.rb +12 -12
  127. data/spec/controllers/depositors_controller_spec.rb +8 -8
  128. data/spec/controllers/downloads_controller_spec.rb +10 -11
  129. data/spec/controllers/featured_work_lists_controller_spec.rb +4 -4
  130. data/spec/controllers/featured_works_controller_spec.rb +11 -12
  131. data/spec/controllers/generic_files_controller_spec.rb +154 -125
  132. data/spec/controllers/homepage_controller_spec.rb +22 -15
  133. data/spec/controllers/mailbox_controller_spec.rb +20 -36
  134. data/spec/controllers/my/collections_controller_spec.rb +4 -5
  135. data/spec/controllers/my/files_controller_spec.rb +10 -11
  136. data/spec/controllers/my/highlights_controller_spec.rb +4 -5
  137. data/spec/controllers/my/shares_controller_spec.rb +12 -14
  138. data/spec/controllers/my_controller_spec.rb +1 -3
  139. data/spec/controllers/pages_controller_spec.rb +4 -4
  140. data/spec/controllers/single_use_links_controller_spec.rb +1 -3
  141. data/spec/controllers/single_use_links_viewer_controller_spec.rb +1 -2
  142. data/spec/controllers/static_controller_spec.rb +1 -1
  143. data/spec/controllers/tinymce_assets_controller_spec.rb +8 -9
  144. data/spec/controllers/transfers_controller_spec.rb +19 -19
  145. data/spec/controllers/users_controller_spec.rb +33 -35
  146. data/spec/factories/api_items.rb +2 -2
  147. data/spec/factories/content_blocks.rb +1 -1
  148. data/spec/factories/featured_works.rb +1 -1
  149. data/spec/factories/generic_files.rb +3 -3
  150. data/spec/factories/users.rb +7 -8
  151. data/spec/features/browse_dashboard_files_spec.rb +14 -18
  152. data/spec/features/browse_files_spec.rb +3 -4
  153. data/spec/features/catalog_search_spec.rb +3 -5
  154. data/spec/features/cloud_upload_spec.rb +2 -2
  155. data/spec/features/collection_spec.rb +21 -21
  156. data/spec/features/contact_form_spec.rb +10 -11
  157. data/spec/features/display_dashboard_spec.rb +5 -9
  158. data/spec/features/edit_file_spec.rb +8 -9
  159. data/spec/features/featured_item_spec.rb +1 -1
  160. data/spec/features/ingest_upload_files_spec.rb +5 -5
  161. data/spec/features/notifications_spec.rb +2 -6
  162. data/spec/features/ownership_transfer_spec.rb +2 -2
  163. data/spec/features/proxy_spec.rb +2 -2
  164. data/spec/features/search_spec.rb +3 -4
  165. data/spec/features/single_use_links_spec.rb +1 -1
  166. data/spec/features/users_spec.rb +4 -5
  167. data/spec/forms/collection_edit_form_spec.rb +2 -2
  168. data/spec/forms/generic_file_edit_form_spec.rb +6 -7
  169. data/spec/helpers/batch_edits_helper_spec.rb +9 -13
  170. data/spec/helpers/content_block_helper_spec.rb +3 -3
  171. data/spec/helpers/dashboard_helper_spec.rb +19 -24
  172. data/spec/helpers/generic_file_helper_spec.rb +5 -7
  173. data/spec/helpers/sufia_helper_spec.rb +43 -54
  174. data/spec/helpers/trophy_helper_spec.rb +5 -5
  175. data/spec/inputs/multi_value_with_help_input_spec.rb +1 -2
  176. data/spec/inputs/select_with_help_input_spec.rb +19 -15
  177. data/spec/javascripts/jasmine_spec.rb +4 -5
  178. data/spec/javascripts/support/jasmine_helper.rb +9 -9
  179. data/spec/jobs/active_fedora_id_based_job_spec.rb +7 -5
  180. data/spec/jobs/audit_job_spec.rb +7 -7
  181. data/spec/jobs/batch_update_job_spec.rb +5 -6
  182. data/spec/jobs/characterize_job_spec.rb +1 -1
  183. data/spec/jobs/content_depositor_change_event_job_spec.rb +1 -1
  184. data/spec/jobs/create_derivatives_job_spec.rb +5 -5
  185. data/spec/jobs/event_jobs_spec.rb +16 -16
  186. data/spec/jobs/import_url_job_spec.rb +36 -5
  187. data/spec/jobs/ingest_local_file_job_spec.rb +31 -20
  188. data/spec/jobs/sufia_resque_queue_spec.rb +1 -1
  189. data/spec/lib/sufia/analytics_spec.rb +0 -1
  190. data/spec/lib/sufia/arkivo/actor_spec.rb +6 -6
  191. data/spec/lib/sufia/arkivo/schema_validator_spec.rb +18 -18
  192. data/spec/lib/sufia/breadcrumbs_spec.rb +5 -6
  193. data/spec/lib/sufia/messages_spec.rb +11 -12
  194. data/spec/lib/sufia/readable_permissions_spec.rb +8 -10
  195. data/spec/lib/sufia/upload_complete_behavior_spec.rb +6 -7
  196. data/spec/lib/sufia/user_stat_importer_spec.rb +30 -33
  197. data/spec/lib/sufia/writable_permissions_spec.rb +1 -3
  198. data/spec/lib/sufia/zotero/config_spec.rb +4 -6
  199. data/spec/models/ability_spec.rb +11 -9
  200. data/spec/models/batch_spec.rb +13 -13
  201. data/spec/models/characterization_spec.rb +2 -3
  202. data/spec/models/checksum_audit_log_spec.rb +18 -19
  203. data/spec/models/collection_spec.rb +11 -12
  204. data/spec/models/content_block_spec.rb +33 -22
  205. data/spec/models/download_spec.rb +3 -5
  206. data/spec/models/featured_work_list_spec.rb +3 -3
  207. data/spec/models/featured_work_spec.rb +12 -14
  208. data/spec/models/file_content_datastream_spec.rb +9 -7
  209. data/spec/models/file_download_stat_spec.rb +34 -40
  210. data/spec/models/file_usage_spec.rb +46 -52
  211. data/spec/models/file_view_stat_spec.rb +35 -41
  212. data/spec/models/fits_datastream_spec.rb +23 -25
  213. data/spec/models/generic_file/visibility_spec.rb +10 -5
  214. data/spec/models/generic_file_spec.rb +86 -88
  215. data/spec/models/geo_names_resource_spec.rb +3 -5
  216. data/spec/models/local_authority_spec.rb +30 -33
  217. data/spec/models/pageview_spec.rb +3 -3
  218. data/spec/models/proxy_deposit_request_spec.rb +3 -3
  219. data/spec/models/single_use_link_spec.rb +36 -36
  220. data/spec/models/solr_document_spec.rb +3 -6
  221. data/spec/models/trophy_spec.rb +8 -9
  222. data/spec/models/user_mailbox_spec.rb +62 -0
  223. data/spec/models/user_spec.rb +28 -29
  224. data/spec/presenters/presenter_renderer_spec.rb +1 -1
  225. data/spec/presenters/sufia/generic_file_presenter_spec.rb +5 -5
  226. data/spec/presenters/sufia/version_list_presenter_spec.rb +2 -2
  227. data/spec/presenters/sufia/version_presenter_spec.rb +1 -1
  228. data/spec/routing/featured_works_route_spec.rb +4 -4
  229. data/spec/routing/ownership_transfers_route_spec.rb +1 -1
  230. data/spec/routing/route_spec.rb +89 -89
  231. data/spec/services/generic_file_audit_service_spec.rb +8 -8
  232. data/spec/services/repository_audit_service_spec.rb +7 -3
  233. data/spec/spec_helper.rb +5 -4
  234. data/spec/support/features/session_helpers.rb +1 -1
  235. data/spec/support/input_support.rb +1 -2
  236. data/spec/support/rake.rb +1 -1
  237. data/spec/support/selectors.rb +1 -6
  238. data/spec/support/statistic_helper.rb +1 -1
  239. data/spec/support/uploaded_file_monkeypatch.rb +1 -1
  240. data/spec/tasks/rake_spec.rb +3 -5
  241. data/spec/views/admin/stats/index.html.erb_spec.rb +16 -16
  242. data/spec/views/batch/edit.html.erb_spec.rb +1 -3
  243. data/spec/views/batch_edits/check_all_spec.rb +5 -5
  244. data/spec/views/batch_edits/edit.html.erb_spec.rb +1 -3
  245. data/spec/views/catalog/index.html.erb_spec.rb +1 -3
  246. data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +4 -5
  247. data/spec/views/collections/_form.html.erb_spec.rb +5 -3
  248. data/spec/views/collections/_show_descriptions.html.erb_spec.rb +7 -8
  249. data/spec/views/collections/_show_document_list.erb_spec.rb +4 -6
  250. data/spec/views/dashboard/index_spec.rb +14 -21
  251. data/spec/views/generic_file/_browse_everything.html.erb_spec.rb +2 -2
  252. data/spec/views/generic_file/_permission_form.html.erb_spec.rb +8 -9
  253. data/spec/views/generic_file/edit.html.erb_spec.rb +7 -7
  254. data/spec/views/generic_file/show.html.erb_spec.rb +24 -25
  255. data/spec/views/generic_file/stats.html.erb_spec.rb +19 -19
  256. data/spec/views/homepage/_announcement.html.erb_spec.rb +51 -0
  257. data/spec/views/homepage/_featured_works.html.erb_spec.rb +5 -9
  258. data/spec/views/homepage/_home_header.html.erb_spec.rb +2 -2
  259. data/spec/views/my/facet.html.erb_spec.rb +4 -4
  260. data/spec/views/single_use_links/new_download.html.erb_spec.rb +28 -0
  261. data/spec/views/single_use_links_viewer/show.html.erb_spec.rb +29 -0
  262. data/spec/views/users/_follower_modal.html.erb_spec.rb +7 -8
  263. data/spec/views/users/_following_modal.html.erb_spec.rb +4 -5
  264. data/spec/views/users/_notify_number.html.erb_spec.rb +2 -5
  265. data/spec/views/users/_user_util_links.html.erb_spec.rb +5 -8
  266. data/spec/views/users/index.html.erb_spec.rb +4 -6
  267. data/spec/views/users/show.html.erb_spec.rb +4 -7
  268. data/tasks/sufia-dev.rake +19 -3
  269. metadata +20 -5
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Sufia::PresenterRenderer, type: :view do
4
4
  let(:generic_file) { GenericFile.new }
5
5
  let(:presenter) { Sufia::GenericFilePresenter.new(generic_file) }
6
- let(:renderer) { Sufia::PresenterRenderer.new(presenter, view) }
6
+ let(:renderer) { described_class.new(presenter, view) }
7
7
 
8
8
  describe "#label" do
9
9
  context "of a field with a translation" do
@@ -2,15 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe Sufia::GenericFilePresenter do
4
4
  describe ".terms" do
5
- it "should return a list" do
5
+ it "returns a list" do
6
6
  expect(described_class.terms).to eq([:resource_type, :title,
7
- :creator, :contributor, :description, :tag, :rights, :publisher,
8
- :date_created, :subject, :language, :identifier, :based_near,
9
- :related_url])
7
+ :creator, :contributor, :description, :tag, :rights, :publisher,
8
+ :date_created, :subject, :language, :identifier, :based_near,
9
+ :related_url])
10
10
  end
11
11
  end
12
12
 
13
- let(:presenter) { Sufia::GenericFilePresenter.new(file) }
13
+ let(:presenter) { described_class.new(file) }
14
14
 
15
15
  describe '#tweeter' do
16
16
  let(:file) { build(:generic_file).tap { |f| f.apply_depositor_metadata(user) } }
@@ -17,10 +17,10 @@ describe Sufia::VersionListPresenter, :no_clean do
17
17
  end
18
18
  end
19
19
 
20
- subject { Sufia::VersionListPresenter.new([resource_version, resource_version2]) }
20
+ subject { described_class.new([resource_version, resource_version2]) }
21
21
 
22
22
  describe "#each" do
23
- it "should yield version_presenters" do
23
+ it "yields version_presenters" do
24
24
  versions_descending = []
25
25
  subject.each do |v|
26
26
  expect(v).to be_kind_of Sufia::VersionPresenter
@@ -9,7 +9,7 @@ describe Sufia::VersionPresenter, :no_clean do
9
9
  end
10
10
  end
11
11
 
12
- let(:presenter) { Sufia::VersionPresenter.new(resource_version) }
12
+ let(:presenter) { described_class.new(resource_version) }
13
13
 
14
14
  describe "#label" do
15
15
  subject { presenter.label }
@@ -1,15 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "file routes", :type => :routing do
3
+ describe "file routes", type: :routing do
4
4
  routes { Sufia::Engine.routes }
5
- it 'should create a featured_work' do
5
+ it 'creates a featured_work' do
6
6
  expect(post: '/files/1/featured_work').to route_to(controller: 'featured_works', action: 'create', id: '1')
7
7
  end
8
- it 'should remove a featured_work' do
8
+ it 'removes a featured_work' do
9
9
  expect(delete: '/files/1/featured_work').to route_to(controller: 'featured_works', action: 'destroy', id: '1')
10
10
  end
11
11
 
12
- it 'should update a collection of featured works' do
12
+ it 'updates a collection of featured works' do
13
13
  expect(featured_work_lists_path).to eq '/featured_works'
14
14
  expect(post: '/featured_works').to route_to(controller: 'featured_work_lists', action: 'create')
15
15
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "proxy deposit and transfers routing", :type => :routing do
3
+ describe "proxy deposit and transfers routing", type: :routing do
4
4
  routes { Sufia::Engine.routes }
5
5
 
6
6
  it "lists transfers" do
@@ -1,210 +1,210 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Routes', :type => :routing do
3
+ describe 'Routes', type: :routing do
4
4
  routes { Sufia::Engine.routes }
5
5
 
6
6
  describe 'Homepage' do
7
- it 'should route the root url to the homepage controller' do
8
- expect({ get: '/' }).to route_to(controller: 'homepage', action: 'index')
7
+ it 'routes the root url to the homepage controller' do
8
+ expect(get: '/').to route_to(controller: 'homepage', action: 'index')
9
9
  end
10
10
  end
11
11
 
12
12
  describe 'GenericFile' do
13
- it 'should route to citation' do
14
- expect({ get: '/files/1/citation' }).to route_to(controller: 'generic_files', action: 'citation', id: '1')
13
+ it 'routes to citation' do
14
+ expect(get: '/files/1/citation').to route_to(controller: 'generic_files', action: 'citation', id: '1')
15
15
  end
16
16
 
17
- it 'should route to stats' do
18
- expect({ get: '/files/1/stats' }).to route_to(controller: 'generic_files', action: 'stats', id: '1')
17
+ it 'routes to stats' do
18
+ expect(get: '/files/1/stats').to route_to(controller: 'generic_files', action: 'stats', id: '1')
19
19
  end
20
20
 
21
- it 'should route to audit' do
22
- expect({ post: '/files/7/audit' }).to route_to(controller: 'generic_files', action: 'audit', id: '7')
21
+ it 'routes to audit' do
22
+ expect(post: '/files/7/audit').to route_to(controller: 'generic_files', action: 'audit', id: '7')
23
23
  end
24
24
 
25
- it 'should route to create' do
26
- expect({ post: '/files' }).to route_to(controller: 'generic_files', action: 'create')
25
+ it 'routes to create' do
26
+ expect(post: '/files').to route_to(controller: 'generic_files', action: 'create')
27
27
  end
28
28
 
29
- it 'should route to new' do
30
- expect({ get: '/files/new' }).to route_to(controller: 'generic_files', action: 'new')
29
+ it 'routes to new' do
30
+ expect(get: '/files/new').to route_to(controller: 'generic_files', action: 'new')
31
31
  end
32
32
 
33
- it 'should route to edit' do
34
- expect({ get: '/files/3/edit' }).to route_to(controller: 'generic_files', action: 'edit', id: '3')
33
+ it 'routes to edit' do
34
+ expect(get: '/files/3/edit').to route_to(controller: 'generic_files', action: 'edit', id: '3')
35
35
  end
36
36
 
37
- it "should route to show" do
38
- expect({ get: '/files/4' }).to route_to(controller: 'generic_files', action: 'show', id: '4')
37
+ it "routes to show" do
38
+ expect(get: '/files/4').to route_to(controller: 'generic_files', action: 'show', id: '4')
39
39
  end
40
40
 
41
- it "should route to update" do
42
- expect({ put: '/files/5' }).to route_to(controller: 'generic_files', action: 'update', id: '5')
41
+ it "routes to update" do
42
+ expect(put: '/files/5').to route_to(controller: 'generic_files', action: 'update', id: '5')
43
43
  end
44
44
 
45
- it "should route to destroy" do
46
- expect({ delete: '/files/6' }).to route_to(controller: 'generic_files', action: 'destroy', id: '6')
45
+ it "routes to destroy" do
46
+ expect(delete: '/files/6').to route_to(controller: 'generic_files', action: 'destroy', id: '6')
47
47
  end
48
48
 
49
- it "should *not* route to index" do
50
- expect({ get: '/files' }).not_to route_to(controller: 'generic_files', action: 'index')
49
+ it "*not*s route to index" do
50
+ expect(get: '/files').not_to route_to(controller: 'generic_files', action: 'index')
51
51
  end
52
52
  end
53
53
 
54
54
  describe 'Batch' do
55
- it "should route to edit" do
56
- expect({ get: '/batches/1/edit' }).to route_to(controller: 'batch', action: 'edit', id: '1')
55
+ it "routes to edit" do
56
+ expect(get: '/batches/1/edit').to route_to(controller: 'batch', action: 'edit', id: '1')
57
57
  end
58
58
 
59
- it "should route to update" do
60
- expect({ post: '/batches/2' }).to route_to(controller: 'batch', action: 'update', id: '2')
59
+ it "routes to update" do
60
+ expect(post: '/batches/2').to route_to(controller: 'batch', action: 'update', id: '2')
61
61
  end
62
62
  end
63
63
 
64
64
  describe 'Download' do
65
- it "should route to show" do
66
- expect({ get: '/downloads/9' }).to route_to(controller: 'downloads', action: 'show', id: '9')
65
+ it "routes to show" do
66
+ expect(get: '/downloads/9').to route_to(controller: 'downloads', action: 'show', id: '9')
67
67
  end
68
68
  end
69
69
 
70
70
  describe 'Dashboard' do
71
- it "should route to dashboard" do
72
- expect({ get: '/dashboard' }).to route_to(controller: 'dashboard', action: 'index')
71
+ it "routes to dashboard" do
72
+ expect(get: '/dashboard').to route_to(controller: 'dashboard', action: 'index')
73
73
  end
74
74
 
75
- it "should route to dashboard activity" do
76
- expect({ get: '/dashboard/activity' }).to route_to(controller: 'dashboard', action: 'activity')
75
+ it "routes to dashboard activity" do
76
+ expect(get: '/dashboard/activity').to route_to(controller: 'dashboard', action: 'activity')
77
77
  end
78
78
 
79
- it "should route to my files tab" do
80
- expect({ get: '/dashboard/files' }).to route_to(controller: 'my/files', action: 'index')
79
+ it "routes to my files tab" do
80
+ expect(get: '/dashboard/files').to route_to(controller: 'my/files', action: 'index')
81
81
  end
82
82
 
83
- it "should route to my collections tab" do
84
- expect({ get: '/dashboard/collections' }).to route_to(controller: 'my/collections', action: 'index')
83
+ it "routes to my collections tab" do
84
+ expect(get: '/dashboard/collections').to route_to(controller: 'my/collections', action: 'index')
85
85
  end
86
86
 
87
- it "should route to my highlighted tab" do
88
- expect({ get: '/dashboard/highlights' }).to route_to(controller: 'my/highlights', action: 'index')
87
+ it "routes to my highlighted tab" do
88
+ expect(get: '/dashboard/highlights').to route_to(controller: 'my/highlights', action: 'index')
89
89
  end
90
90
 
91
- it "should route to my shared tab" do
92
- expect({ get: '/dashboard/shares' }).to route_to(controller: 'my/shares', action: 'index')
91
+ it "routes to my shared tab" do
92
+ expect(get: '/dashboard/shares').to route_to(controller: 'my/shares', action: 'index')
93
93
  end
94
94
  end
95
95
 
96
96
  describe 'Advanced Search' do
97
- it "should route to search" do
98
- expect({ get: '/search' }).to route_to(controller: 'advanced', action: 'index')
97
+ it "routes to search" do
98
+ expect(get: '/search').to route_to(controller: 'advanced', action: 'index')
99
99
  end
100
100
  end
101
101
 
102
102
  describe 'Authorities' do
103
- it "should route to query" do
104
- expect({ get: '/authorities/subject/bio' }).to route_to(controller: 'authorities', action: 'query', model: 'subject', term: 'bio')
103
+ it "routes to query" do
104
+ expect(get: '/authorities/subject/bio').to route_to(controller: 'authorities', action: 'query', model: 'subject', term: 'bio')
105
105
  end
106
106
  end
107
107
 
108
108
  describe 'Users' do
109
- it 'should route to user trophies' do
110
- expect({ post: '/users/bob135/trophy' }).to route_to(controller: 'users', action: 'toggle_trophy', id: 'bob135')
109
+ it 'routes to user trophies' do
110
+ expect(post: '/users/bob135/trophy').to route_to(controller: 'users', action: 'toggle_trophy', id: 'bob135')
111
111
  end
112
- it 'should route to user profile' do
113
- expect({ get: '/users/bob135' }).to route_to(controller: 'users', action: 'show', id: 'bob135')
112
+ it 'routes to user profile' do
113
+ expect(get: '/users/bob135').to route_to(controller: 'users', action: 'show', id: 'bob135')
114
114
  end
115
115
 
116
- it "should route to edit profile" do
117
- expect({ get: '/users/bob135/edit' }).to route_to(controller: 'users', action: 'edit', id: 'bob135')
116
+ it "routes to edit profile" do
117
+ expect(get: '/users/bob135/edit').to route_to(controller: 'users', action: 'edit', id: 'bob135')
118
118
  end
119
119
 
120
- it "should route to update profile" do
121
- expect({ put: '/users/bob135' }).to route_to(controller: 'users', action: 'update', id: 'bob135')
120
+ it "routes to update profile" do
121
+ expect(put: '/users/bob135').to route_to(controller: 'users', action: 'update', id: 'bob135')
122
122
  end
123
123
 
124
- it "should route to user follow" do
125
- expect({ post: '/users/bob135/follow' }).to route_to(controller: 'users', action: 'follow', id: 'bob135')
124
+ it "routes to user follow" do
125
+ expect(post: '/users/bob135/follow').to route_to(controller: 'users', action: 'follow', id: 'bob135')
126
126
  end
127
127
 
128
- it "should route to user unfollow" do
129
- expect({ post: '/users/bob135/unfollow' }).to route_to(controller: 'users', action: 'unfollow', id: 'bob135')
128
+ it "routes to user unfollow" do
129
+ expect(post: '/users/bob135/unfollow').to route_to(controller: 'users', action: 'unfollow', id: 'bob135')
130
130
  end
131
131
  end
132
132
 
133
133
  describe "Directory" do
134
- it "should route to user" do
135
- expect({ get: '/directory/user/xxx666' }).to route_to(controller: 'directory', action: 'user', uid: 'xxx666')
134
+ it "routes to user" do
135
+ expect(get: '/directory/user/xxx666').to route_to(controller: 'directory', action: 'user', uid: 'xxx666')
136
136
  end
137
137
 
138
- it "should route to user attribute" do
139
- expect({ get: '/directory/user/zzz777/email' }).to route_to(controller: 'directory', action: 'user_attribute', uid: 'zzz777', attribute: 'email')
138
+ it "routes to user attribute" do
139
+ expect(get: '/directory/user/zzz777/email').to route_to(controller: 'directory', action: 'user_attribute', uid: 'zzz777', attribute: 'email')
140
140
  end
141
141
 
142
- it "should route to group and allow periods" do
143
- expect({ get: '/directory/group/all.staff' }).to route_to(controller: 'directory', action: 'group', cn: 'all.staff')
142
+ it "routes to group and allow periods" do
143
+ expect(get: '/directory/group/all.staff').to route_to(controller: 'directory', action: 'group', cn: 'all.staff')
144
144
  end
145
145
  end
146
146
 
147
147
  describe "Notifications" do
148
- it "should have index" do
149
- expect( get: '/notifications').to route_to(controller: 'mailbox', action: 'index')
148
+ it "has index" do
149
+ expect(get: '/notifications').to route_to(controller: 'mailbox', action: 'index')
150
150
  expect(notifications_path).to eq '/notifications'
151
151
  end
152
- it "should allow deleting" do
153
- expect( delete: '/notifications/123').to route_to(controller: 'mailbox', action: 'destroy', id: '123')
152
+ it "allows deleting" do
153
+ expect(delete: '/notifications/123').to route_to(controller: 'mailbox', action: 'destroy', id: '123')
154
154
  expect(notification_path(123)).to eq '/notifications/123'
155
155
  end
156
- it "should allow deleting all of them" do
157
- expect( delete: '/notifications/delete_all').to route_to(controller: 'mailbox', action: 'delete_all')
156
+ it "allows deleting all of them" do
157
+ expect(delete: '/notifications/delete_all').to route_to(controller: 'mailbox', action: 'delete_all')
158
158
  expect(delete_all_notifications_path).to eq '/notifications/delete_all'
159
159
  end
160
160
  end
161
161
 
162
162
  describe "Contact Form" do
163
- it "should route to new" do
164
- expect({ get: '/contact' }).to route_to(controller: 'contact_form', action: 'new')
163
+ it "routes to new" do
164
+ expect(get: '/contact').to route_to(controller: 'contact_form', action: 'new')
165
165
  end
166
166
 
167
- it "should route to create" do
168
- expect({ post: '/contact' }).to route_to(controller: 'contact_form', action: 'create')
167
+ it "routes to create" do
168
+ expect(post: '/contact').to route_to(controller: 'contact_form', action: 'create')
169
169
  end
170
170
  end
171
171
 
172
172
  describe "Dynamically edited pages" do
173
- it "should route to about" do
174
- expect({ get: '/about' }).to route_to(controller: 'pages', action: 'show', id: 'about_page')
173
+ it "routes to about" do
174
+ expect(get: '/about').to route_to(controller: 'pages', action: 'show', id: 'about_page')
175
175
  end
176
176
  end
177
177
 
178
178
  describe "Static Pages" do
179
- it "should route to help" do
180
- expect({ get: '/help' }).to route_to(controller: 'static', action: 'help')
179
+ it "routes to help" do
180
+ expect(get: '/help').to route_to(controller: 'static', action: 'help')
181
181
  end
182
182
 
183
- it "should route to terms" do
184
- expect({ get: '/terms' }).to route_to(controller: 'static', action: 'terms')
183
+ it "routes to terms" do
184
+ expect(get: '/terms').to route_to(controller: 'static', action: 'terms')
185
185
  end
186
186
 
187
- it "should route to zotero" do
188
- expect({ get: '/zotero' }).to route_to(controller: 'static', action: 'zotero')
187
+ it "routes to zotero" do
188
+ expect(get: '/zotero').to route_to(controller: 'static', action: 'zotero')
189
189
  end
190
190
 
191
- it "should route to mendeley" do
192
- expect({ get: '/mendeley' }).to route_to(controller: 'static', action: 'mendeley')
191
+ it "routes to mendeley" do
192
+ expect(get: '/mendeley').to route_to(controller: 'static', action: 'mendeley')
193
193
  end
194
194
 
195
- it "should route to versions" do
196
- expect({ get: '/versions' }).to route_to(controller: 'static', action: 'versions')
195
+ it "routes to versions" do
196
+ expect(get: '/versions').to route_to(controller: 'static', action: 'versions')
197
197
  end
198
198
 
199
- it "should *not* route a bogus static page" do
200
- expect({ get: '/awesome' }).not_to route_to(controller: 'static', action: 'awesome')
199
+ it "*not*s route a bogus static page" do
200
+ expect(get: '/awesome').not_to route_to(controller: 'static', action: 'awesome')
201
201
  end
202
202
  end
203
203
 
204
204
  describe "Catch-all" do
205
- it "should route non-existent routes to errors" do
205
+ it "routes non-existent routes to errors" do
206
206
  pending "The default route is turned off in testing, so that errors are raised"
207
- expect({ get: '/awesome' }).to route_to(controller: 'errors', action: 'routing', error: 'awesome')
207
+ expect(get: '/awesome').to route_to(controller: 'errors', action: 'routing', error: 'awesome')
208
208
  end
209
209
  end
210
210
  end
@@ -8,7 +8,7 @@ describe Sufia::GenericFileAuditService do
8
8
  end
9
9
  end
10
10
 
11
- let(:service) { Sufia::GenericFileAuditService.new(f) }
11
+ let(:service) { described_class.new(f) }
12
12
 
13
13
  describe "#audit" do
14
14
  before do
@@ -47,17 +47,17 @@ describe Sufia::GenericFileAuditService do
47
47
 
48
48
  describe "file loaded from fedora" do
49
49
  context "when no audits have been run" do
50
- it "should report that audits have not been run" do
50
+ it "reports that audits have not been run" do
51
51
  expect(subject).to eq "Audits have not yet been run on this file."
52
52
  end
53
53
  end
54
54
 
55
55
  context "when no audit is passing" do
56
56
  before do
57
- ChecksumAuditLog.create!(pass: 1, generic_file_id: f.id, version: f.content.versions.first.label, dsid: 'content')
57
+ ChecksumAuditLog.create!(pass: 1, generic_file_id: f.id, version: f.content.versions.first.label, dsid: 'content')
58
58
  end
59
59
 
60
- it "should report that audit result" do
60
+ it "reports that audit result" do
61
61
  expect(subject).to eq 1
62
62
  end
63
63
  end
@@ -65,9 +65,9 @@ describe Sufia::GenericFileAuditService do
65
65
 
66
66
  describe "file loaded from solr" do
67
67
  let(:solr_file) { GenericFile.load_instance_from_solr(f.id) }
68
- let(:service) { Sufia::GenericFileAuditService.new(solr_file) }
68
+ let(:service) { described_class.new(solr_file) }
69
69
 
70
- it "should not audit by version" do
70
+ it "does not audit by version" do
71
71
  expect(service).not_to receive(:audit_stat_by_version)
72
72
  expect(subject).to eq "Audits have not yet been run on this file."
73
73
  end
@@ -77,7 +77,7 @@ describe Sufia::GenericFileAuditService do
77
77
  ChecksumAuditLog.create!(pass: 1, generic_file_id: f.id, version: f.content.versions.first.label, dsid: 'content')
78
78
  end
79
79
 
80
- it "should report that audit result" do
80
+ it "reports that audit result" do
81
81
  expect(service).not_to receive(:audit_stat_by_version)
82
82
  expect(subject).to eq 1
83
83
  end
@@ -89,7 +89,7 @@ describe Sufia::GenericFileAuditService do
89
89
  ChecksumAuditLog.create!(pass: 1, generic_file_id: f.id, version: f.content.versions.first.label, dsid: 'content')
90
90
  end
91
91
 
92
- it "should report that audit result" do
92
+ it "reports that audit result" do
93
93
  expect(service).not_to receive(:audit_stat_by_version)
94
94
  expect(subject).to eq 0
95
95
  end
@@ -10,9 +10,13 @@ describe Sufia::RepositoryAuditService do
10
10
  end
11
11
 
12
12
  describe "#audit_everything" do
13
- it "should audit everything" do
14
- expect_any_instance_of(GenericFile).to receive(:audit)
15
- Sufia::RepositoryAuditService.audit_everything
13
+ it "audits everything" do
14
+ # check that the method we are mocking still exists
15
+ expect(Sufia::GenericFileAuditService.new(nil)).to respond_to(:audit)
16
+
17
+ # make sure the audit gets called
18
+ expect_any_instance_of(Sufia::GenericFileAuditService).to receive(:audit)
19
+ described_class.audit_everything
16
20
  end
17
21
  end
18
22
  end