sufia 6.2.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -52,10 +52,10 @@ if $in_travis
52
52
  def extract_metadata
53
53
  return unless has_content?
54
54
  Hydra::FileCharacterization.characterize(content, filename_for_characterization, :fits) do |config|
55
- config[:fits] = lambda { |filename|
55
+ config[:fits] = lambda do |filename|
56
56
  filename = File.expand_path("../fixtures/pdf_fits.xml", __FILE__)
57
57
  File.read(filename)
58
- }
58
+ end
59
59
  end
60
60
  end
61
61
  end
@@ -68,9 +68,10 @@ if defined?(ClamAV)
68
68
  else
69
69
  class ClamAV
70
70
  include Singleton
71
- def scanfile(f)
71
+ def scanfile(_f)
72
72
  0
73
73
  end
74
+
74
75
  def loaddb
75
76
  nil
76
77
  end
@@ -116,7 +117,7 @@ RSpec.configure do |config|
116
117
  config.use_transactional_fixtures = false
117
118
 
118
119
  config.before :each do |example|
119
- unless (example.metadata[:type] == :view || example.metadata[:no_clean])
120
+ unless example.metadata[:type] == :view || example.metadata[:no_clean]
120
121
  ActiveFedora::Cleaner.clean!
121
122
  end
122
123
  end
@@ -3,7 +3,7 @@ module Features
3
3
  module SessionHelpers
4
4
  def sign_in(who = :user)
5
5
  logout
6
- user = who.is_a?(User) ? who : FactoryGirl.build(:user).tap { |u| u.save! }
6
+ user = who.is_a?(User) ? who : FactoryGirl.build(:user).tap(&:save!)
7
7
  visit new_user_session_path
8
8
  fill_in 'Email', with: user.email
9
9
  fill_in 'Password', with: user.password
@@ -3,10 +3,9 @@ module InputSupport
3
3
 
4
4
  include RSpec::Rails::HelperExampleGroup
5
5
 
6
- def input_for(object, attribute_name, options={})
6
+ def input_for(object, attribute_name, options = {})
7
7
  helper.simple_form_for object, url: '' do |f|
8
8
  f.input attribute_name, options
9
9
  end
10
10
  end
11
11
  end
12
-
@@ -5,7 +5,7 @@ module RakeHelper
5
5
  @rake = Rake::Application.new
6
6
  Rake.application = @rake
7
7
  Rake::Task.define_task(:environment)
8
- files.each {|file| load file}
8
+ files.each { |file| load file }
9
9
  end
10
10
 
11
11
  def run_task(task, arg = nil)
@@ -1,7 +1,5 @@
1
1
  module Selectors
2
-
3
2
  module Header
4
-
5
3
  def user_notifications_link
6
4
  within '#user_utility_links' do
7
5
  find '#notify_link'
@@ -16,8 +14,7 @@ module Selectors
16
14
  end
17
15
 
18
16
  module Dashboard
19
-
20
- def db_item_actions_toggle item
17
+ def db_item_actions_toggle(item)
21
18
  within "#document_#{item.id}" do
22
19
  find '.dropdown-toggle'
23
20
  end
@@ -25,7 +22,6 @@ module Selectors
25
22
  end
26
23
 
27
24
  module NewTransfers
28
-
29
25
  def new_owner_dropdown
30
26
  find '#s2id_proxy_deposit_request_transfer_to'
31
27
  end
@@ -50,7 +46,6 @@ module Selectors
50
46
  end
51
47
 
52
48
  module Transfers
53
-
54
49
  def first_sent_cancel_button
55
50
  within '#outgoing-transfers' do
56
51
  find '.btn.btn-danger'
@@ -1,6 +1,6 @@
1
1
  module StatisticHelper
2
2
  def statistic_date(date)
3
- date.to_datetime.to_i*1000
3
+ date.to_datetime.to_i * 1000
4
4
  end
5
5
 
6
6
  RSpec.configure do |config|
@@ -1,4 +1,4 @@
1
- #Monkey patch UploadedFile so that it responds to read (same as ActionDispatch::Http::UploadedFile). Required by RestClient when posting to fedora.
1
+ # Monkey patch UploadedFile so that it responds to read (same as ActionDispatch::Http::UploadedFile). Required by RestClient when posting to fedora.
2
2
  class Rack::Test::UploadedFile
3
3
  def read(*args)
4
4
  @tempfile.read(*args)
@@ -2,21 +2,20 @@ require 'spec_helper'
2
2
  require 'rake'
3
3
 
4
4
  describe "Rake tasks" do
5
-
6
5
  describe "sufia:empty_batches" do
7
6
  before do
8
7
  load_rake_environment [File.expand_path("../../../sufia-models/lib/tasks/batch_cleanup.rake", __FILE__)]
9
8
  end
10
9
  subject { run_task "sufia:empty_batches" }
11
-
10
+
12
11
  context "without an empty batch" do
13
12
  it { is_expected.to eq "Output: \n Errors:" }
14
13
  end
15
-
14
+
16
15
  context "with an empty batch" do
17
16
  before { Batch.create("empty-batch") }
18
17
  it { is_expected.to start_with("Output: empty-batch contains no files - to delete, rerun with the remove option") }
19
-
18
+
20
19
  describe "removing the empty batch" do
21
20
  subject { run_task "sufia:empty_batches", "remove" }
22
21
  it { is_expected.to start_with("Output: empty-batch contains no files - deleted") }
@@ -75,5 +74,4 @@ describe "Rake tasks" do
75
74
  File.delete("abc123.txt")
76
75
  end
77
76
  end
78
-
79
77
  end
@@ -1,45 +1,45 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "admin/stats/index.html.erb" do
4
+ before do
5
+ assign(:files_count, {})
6
+ assign(:top_formats, [])
7
+ assign(:users_stats, {})
8
+ assign(:recent_users, [])
9
+ assign(:deposit_stats, {})
10
+ assign(:depositors, [])
11
+ end
12
+
4
13
  context "default depositors" do
5
- let(:top_5_active_users) do
14
+ let(:top_5_active_users) do
6
15
  users = {}
7
- 5.times { |i| users[i.to_s] = i}
16
+ 5.times { |i| users[i.to_s] = i }
8
17
  users
9
18
  end
10
19
  before do
11
- assign(:files_count, {})
12
- assign(:top_formats, [])
13
- assign(:users_stats, {})
14
- assign(:recent_users, [])
15
20
  assign(:active_users, top_5_active_users)
16
21
  render
17
22
  end
18
- it "should show top 5 depositors and option to view more" do
23
+ it "shows top 5 depositors and option to view more" do
19
24
  expect(rendered).to have_content("(top 5)")
20
25
  expect(rendered).to have_content("View top 20")
21
26
  end
22
27
  end
23
28
 
24
29
  context "top 20 depositors" do
25
- let(:top_20_active_users) do
30
+ let(:top_20_active_users) do
26
31
  users = {}
27
- 20.times { |i| users[i.to_s] = i}
32
+ 20.times { |i| users[i.to_s] = i }
28
33
  users
29
34
  end
30
35
  before do
31
- assign(:files_count, {})
32
- assign(:top_formats, [])
33
- assign(:users_stats, {})
34
- assign(:recent_users, [])
35
36
  assign(:active_users, top_20_active_users)
36
37
  params[:dep_count] = 20
37
38
  render
38
39
  end
39
- it "should show top 20 depositors, without an option to view more" do
40
+ it "shows top 20 depositors, without an option to view more" do
40
41
  expect(rendered).to have_content("(top 20)")
41
42
  expect(rendered).to_not have_content("View top 20")
42
43
  end
43
44
  end
44
-
45
- end
45
+ end
@@ -16,7 +16,7 @@ describe 'batch/edit.html.erb' do
16
16
  render
17
17
  end
18
18
 
19
- it "should draw the page" do
19
+ it "draws the page" do
20
20
  # form
21
21
  expect(rendered).to have_selector "form#new_generic_file"
22
22
  # should have browser validations
@@ -35,7 +35,5 @@ describe 'batch/edit.html.erb' do
35
35
  page.all('select#generic_file_rights option').each do |elem|
36
36
  expect(elem.value).to_not be_empty
37
37
  end
38
-
39
38
  end
40
39
  end
41
-
@@ -1,20 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Check All', :type => :view do
4
- before (:all) do
5
- @document_list = ['a','b','c']
3
+ describe 'Check All', type: :view do
4
+ before(:all) do
5
+ @document_list = ['a', 'b', 'c']
6
6
  @batch_size_on_other_page = 0
7
7
  @max_batch_size = 100
8
8
  end
9
9
 
10
- it 'should render batch edits actions' do
10
+ it 'renders batch edits actions' do
11
11
  allow(controller).to receive(:controller_name).and_return('batch_edits')
12
12
  controller.prepend_view_path "app/views/batch_edits"
13
13
  html = render partial: 'batch_edits/check_all'
14
14
  expect(html).to have_selector("li[data-behavior='batch-edit-select-abc']")
15
15
  end
16
16
 
17
- it 'should render actions for my items' do
17
+ it 'renders actions for my items' do
18
18
  allow(controller).to receive(:controller_name).and_return('my')
19
19
  controller.prepend_view_path "app/views/my"
20
20
  html = render partial: 'batch_edits/check_all'
@@ -11,9 +11,7 @@ describe 'batch_edits/edit.html.erb' do
11
11
  render
12
12
  end
13
13
 
14
- it "should draw tooltip for description" do
14
+ it "draws tooltip for description" do
15
15
  expect(rendered).to have_selector ".generic_file_description a i.help-icon"
16
16
  end
17
17
  end
18
-
19
-
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'catalog/index.html.erb' do
4
-
5
4
  let(:collection) { stub_model(Collection, title: 'collection1', id: 'abc123') }
6
5
  let(:doc) { SolrDocument.new(collection.to_solr) }
7
6
 
@@ -17,7 +16,7 @@ describe 'catalog/index.html.erb' do
17
16
  params[:view] = 'gallery'
18
17
 
19
18
  resp = []
20
- assign(:response, resp )
19
+ assign(:response, resp)
21
20
  allow(resp).to receive(:total_pages).and_return(1)
22
21
  allow(resp).to receive(:current_page).and_return(1)
23
22
  allow(resp).to receive(:limit_value).and_return(10)
@@ -34,5 +33,4 @@ describe 'catalog/index.html.erb' do
34
33
  page = Capybara::Node::Simple.new(rendered)
35
34
  expect(page).to have_selector("span.glyphicon.glyphicon-th.collection-icon-search")
36
35
  end
37
-
38
36
  end
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'catalog/_sort_and_per_page.html.erb', :type => :view do
3
+ describe 'catalog/_sort_and_per_page.html.erb', type: :view do
4
4
  before do
5
5
  allow(controller).to receive(:current_user).and_return(stub_model(User))
6
6
  allow_any_instance_of(Ability).to receive(:can?).and_return(true)
7
- @resp = ["a","b","c"]
8
- assign(:response, @resp )
7
+ @resp = ["a", "b", "c"]
8
+ assign(:response, @resp)
9
9
  allow(@resp).to receive(:total_count).and_return(20)
10
10
  allow(@resp).to receive(:limit_value).and_return(3)
11
11
  allow(@resp).to receive(:rows).and_return(3)
@@ -21,10 +21,9 @@ describe 'catalog/_sort_and_per_page.html.erb', :type => :view do
21
21
  expect(page).to have_selector('span.page_entries', count: 1)
22
22
  expect(rendered).to include("<strong>4</strong> - <strong>6</strong> of <strong>20</strong>")
23
23
  end
24
-
24
+
25
25
  it 'displays the relevance option for sorting' do
26
26
  render
27
27
  expect(rendered).to include("<li><a href=\"/catalog?sort=score+desc%2C+date_uploaded_dtsi+desc\">relevance</a></li>")
28
28
  end
29
-
30
29
  end
@@ -1,8 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'collections/_form.html.erb' do
4
- let(:collection) { Collection.new(title: 'the title', description: 'the description',
5
- creator: ['the creator'])}
4
+ let(:collection) do
5
+ Collection.new(title: 'the title', description: 'the description',
6
+ creator: ['the creator'])
7
+ end
6
8
 
7
9
  let(:collection_form) { Sufia::Forms::CollectionEditForm.new(collection) }
8
10
 
@@ -11,7 +13,7 @@ describe 'collections/_form.html.erb' do
11
13
  assign(:form, collection_form)
12
14
  end
13
15
 
14
- it "should draw the metadata fields for collection" do
16
+ it "draws the metadata fields for collection" do
15
17
  render
16
18
  expect(rendered).to have_selector("input#collection_title")
17
19
  expect(rendered).to_not have_selector("div#additional_title.multi_value")
@@ -1,14 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'collections/_show_descriptions.html.erb', :type => :view do
3
+ describe 'collections/_show_descriptions.html.erb', type: :view do
4
4
  context 'displaying a custom collection' do
5
5
  let(:collection) do
6
6
  mock_model(Collection,
7
- resource_type: [], creator: [], contributor: [], tag: [],
8
- description: '', title: 'hmm',
9
- rights: [], publisher: [], date_created: ['2000-01-01'], subject: [],
10
- language: [], identifier: [], based_near: [], related_url: [],
11
- members: ['foo', 'bar'], bytes: 123456678
7
+ resource_type: [], creator: [], contributor: [], tag: [],
8
+ description: '', title: 'hmm',
9
+ rights: [], publisher: [], date_created: ['2000-01-01'], subject: [],
10
+ language: [], identifier: [], based_near: [], related_url: [],
11
+ members: ['foo', 'bar'], bytes: 123_456_678
12
12
  )
13
13
  end
14
14
  before do
@@ -17,8 +17,7 @@ describe 'collections/_show_descriptions.html.erb', :type => :view do
17
17
 
18
18
  let(:presenter) { Sufia::CollectionPresenter.new(collection) }
19
19
 
20
-
21
- it "should draw the metadata fields for collection" do
20
+ it "draws the metadata fields for collection" do
22
21
  render
23
22
  expect(rendered).to have_content 'Date Created'
24
23
  expect(rendered).to include('itemprop="dateCreated"')
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'collections/_show_document_list.html.erb', :type => :view do
4
-
3
+ describe 'collections/_show_document_list.html.erb', type: :view do
5
4
  let(:user) { FactoryGirl.find_or_create(:jill) }
6
5
  let(:collection) { mock_model(Collection) }
7
6
 
@@ -12,7 +11,7 @@ describe 'collections/_show_document_list.html.erb', :type => :view do
12
11
  gf
13
12
  end
14
13
 
15
- let(:documents) {[file]}
14
+ let(:documents) { [file] }
16
15
 
17
16
  context 'when not logged in' do
18
17
  before do
@@ -22,10 +21,9 @@ describe 'collections/_show_document_list.html.erb', :type => :view do
22
21
  allow(file).to receive(:edit_people).and_return([])
23
22
  end
24
23
 
25
- it "should render collection" do
26
- render(partial: 'collections/show_document_list.html.erb', locals: {documents: documents})
24
+ it "renders collection" do
25
+ render(partial: 'collections/show_document_list.html.erb', locals: { documents: documents })
27
26
  expect(rendered).to have_content 'One Hundred Years of Solitude'
28
27
  end
29
28
  end
30
-
31
29
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "dashboard/index.html.erb", :type => :view do
4
-
3
+ describe "dashboard/index.html.erb", type: :view do
5
4
  before do
6
5
  @user = mock_model(User, name: "Charles Francis Xavier", user_key: "charles")
7
6
  allow(@user).to receive(:title).and_return("Professor, Head")
@@ -10,7 +9,7 @@ describe "dashboard/index.html.erb", :type => :view do
10
9
  allow(@user).to receive(:email).and_return("chuck@xsgy.edu")
11
10
  allow(@user).to receive(:login).and_return("chuck")
12
11
  allow(@user).to receive(:all_following).and_return(["magneto"])
13
- allow(@user).to receive(:followers).and_return(["wolverine","storm"])
12
+ allow(@user).to receive(:followers).and_return(["wolverine", "storm"])
14
13
  allow(@user).to receive(:can_receive_deposits_from).and_return([])
15
14
  allow(@user).to receive(:total_file_views).and_return(1)
16
15
  allow(@user).to receive(:total_file_downloads).and_return(3)
@@ -28,13 +27,12 @@ describe "dashboard/index.html.erb", :type => :view do
28
27
  let(:can_create_collection) { true }
29
28
 
30
29
  describe "heading" do
31
-
32
30
  before do
33
31
  render
34
32
  @heading = view.content_for(:heading)
35
33
  end
36
34
 
37
- it "should display welcome message and links" do
35
+ it "displays welcome message and links" do
38
36
  expect(@heading).to have_link("Upload", sufia.new_generic_file_path)
39
37
  expect(@heading).to have_link("Create Collection", collections.new_collection_path)
40
38
  expect(@heading).to have_link("View Files", sufia.dashboard_files_path)
@@ -44,27 +42,25 @@ describe "dashboard/index.html.erb", :type => :view do
44
42
 
45
43
  context "when the user can't create files" do
46
44
  let(:can_create_file) { false }
47
- it "should not display the upload button" do
45
+ it "does not display the upload button" do
48
46
  expect(@heading).not_to have_link("Upload", sufia.new_generic_file_path)
49
47
  end
50
48
  end
51
49
  context "when the user can't create collections" do
52
50
  let(:can_create_collection) { false }
53
- it "should not display the create collection button" do
51
+ it "does not display the create collection button" do
54
52
  expect(@heading).not_to have_link("Create Collection", collections.new_collection_path)
55
53
  end
56
54
  end
57
-
58
55
  end
59
56
 
60
57
  describe "sidebar" do
61
-
62
58
  before do
63
59
  render
64
60
  @sidebar = view.content_for(:sidebar)
65
61
  end
66
62
 
67
- it "should display information about the user" do
63
+ it "displays information about the user" do
68
64
  expect(@sidebar).to include "Charles Francis Xavier"
69
65
  expect(@sidebar).to include "Professor, Head"
70
66
  expect(@sidebar).to include "Xavier’s School for Gifted Youngsters"
@@ -72,12 +68,12 @@ describe "dashboard/index.html.erb", :type => :view do
72
68
  expect(@sidebar).to include "chuck@xsgy.edu"
73
69
  end
74
70
 
75
- it "should have links to view and edit the user's profile" do
71
+ it "has links to view and edit the user's profile" do
76
72
  expect(@sidebar).to include '<a class="btn btn-default" href="' + sufia.profile_path(@user) + '">View Profile</a>'
77
73
  expect(@sidebar).to include '<a class="btn btn-default" href="' + sufia.edit_profile_path(@user) + '">Edit Profile</a>'
78
74
  end
79
75
 
80
- it "should display user statistics" do
76
+ it "displays user statistics" do
81
77
  expect(@sidebar).to include "Your Statistics"
82
78
  expect(@sidebar).to include '<span class="badge">1</span>'
83
79
  expect(@sidebar).to include '<span class="badge">2</span>'
@@ -87,29 +83,26 @@ describe "dashboard/index.html.erb", :type => :view do
87
83
  expect(@sidebar).to include '<span class="badge-optional">3</span> Downloads'
88
84
  end
89
85
 
90
- it "should show the statistics before the profile" do
86
+ it "shows the statistics before the profile" do
91
87
  expect(@sidebar).to match(/Your Statistics.*Charles Francis Xavier/m)
92
88
  end
93
89
  end
94
90
 
95
91
  describe "main" do
96
-
97
92
  context "with activities and notifications" do
98
-
99
93
  before do
100
94
  @now = DateTime.now.to_i
101
95
  assign(:activity, [
102
- { action: 'so and so edited their profile', timestamp: @now },
103
- { action: 'so and so uploaded a file', timestamp: (@now - 360 ) }
96
+ { action: 'so and so edited their profile', timestamp: @now },
97
+ { action: 'so and so uploaded a file', timestamp: (@now - 360) }
104
98
  ])
105
99
  end
106
100
 
107
- it "should include recent activities and notifications" do
101
+ it "includes recent activities and notifications" do
108
102
  render
109
103
  expect(rendered).to include "so and so edited their profile"
110
104
  expect(rendered).to include "6 minutes ago"
111
105
  end
112
-
113
106
  end
114
107
 
115
108
  context "with notifications" do
@@ -167,13 +160,13 @@ describe "dashboard/index.html.erb", :type => :view do
167
160
  end
168
161
 
169
162
  context "without activities and notifications" do
170
- it "should include headings for activities and notifications" do
163
+ it "includes headings for activities and notifications" do
171
164
  render
172
165
  expect(rendered).to include "User Activity"
173
166
  expect(rendered).to include "User Notifications"
174
167
  end
175
168
 
176
- it "should show no activities or notifications" do
169
+ it "shows no activities or notifications" do
177
170
  render
178
171
  expect(rendered).to include "User has no notifications"
179
172
  expect(rendered).to include "User has no recent activity"