sufia 6.0.0 → 6.1.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 (290) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -5
  3. data/CONTRIBUTING.md +4 -4
  4. data/Gemfile +2 -1
  5. data/History.md +69 -0
  6. data/README.md +84 -4
  7. data/SUFIA_VERSION +1 -1
  8. data/app/assets/images/zotero.png +0 -0
  9. data/app/assets/javascripts/sufia/featured_works.js +20 -3
  10. data/app/assets/stylesheets/generic_files.css.erb +2 -2
  11. data/app/assets/stylesheets/sufia.css.scss +2 -2
  12. data/app/assets/stylesheets/sufia/_buttons.scss +2 -2
  13. data/app/assets/stylesheets/sufia/_collections.scss +4 -4
  14. data/app/assets/stylesheets/sufia/_dashboard.scss +1 -1
  15. data/app/assets/stylesheets/sufia/_file-listing.scss +3 -0
  16. data/app/assets/stylesheets/sufia/_modal.scss +4 -0
  17. data/app/assets/stylesheets/sufia/_settings.scss +4 -3
  18. data/app/assets/stylesheets/sufia/_styles.scss +4 -0
  19. data/app/controllers/admin/stats_controller.rb +68 -0
  20. data/app/controllers/api/items_controller.rb +78 -0
  21. data/app/controllers/api/zotero_controller.rb +70 -0
  22. data/app/controllers/authorities_controller.rb +6 -5
  23. data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +2 -1
  24. data/app/controllers/concerns/sufia/breadcrumbs.rb +1 -1
  25. data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +11 -0
  26. data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +1 -1
  27. data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +1 -1
  28. data/app/controllers/concerns/sufia/files_controller_behavior.rb +23 -11
  29. data/app/controllers/concerns/sufia/my_controller_behavior.rb +1 -7
  30. data/app/controllers/concerns/sufia/users_controller_behavior.rb +1 -2
  31. data/app/controllers/my/collections_controller.rb +1 -0
  32. data/app/controllers/my/files_controller.rb +1 -1
  33. data/app/helpers/sufia/sufia_helper_behavior.rb +28 -16
  34. data/app/models/my_search_builder.rb +4 -0
  35. data/app/search_builders/sufia/my_search_builder_behavior.rb +20 -0
  36. data/app/search_builders/sufia/search_builder.rb +1 -1
  37. data/app/views/admin/stats/index.html.erb +68 -0
  38. data/app/views/collections/_action_menu.html.erb +22 -20
  39. data/app/views/collections/_collection.html.erb +1 -1
  40. data/app/views/collections/_form_for_select_collection.html.erb +5 -3
  41. data/app/views/generic_files/_show_actions.html.erb +4 -2
  42. data/app/views/generic_files/show.html.erb +1 -1
  43. data/app/views/layouts/sufia-dashboard.html.erb +5 -4
  44. data/app/views/layouts/sufia-one-column.html.erb +2 -0
  45. data/app/views/layouts/sufia-two-column.html.erb +6 -4
  46. data/app/views/my/_facet_layout.html.erb +2 -2
  47. data/app/views/my/_facets.html.erb +4 -6
  48. data/app/views/my/index.html.erb +4 -3
  49. data/app/views/users/_edit_primary.html.erb +18 -17
  50. data/app/views/users/_follower_modal.html.erb +5 -1
  51. data/app/views/users/_following_modal.html.erb +5 -1
  52. data/app/views/users/_user_info.html.erb +6 -1
  53. data/app/views/users/_zotero.html.erb +12 -0
  54. data/config/locales/sufia.en.yml +10 -1
  55. data/config/routes.rb +23 -1
  56. data/lib/generators/sufia/admin_stat_generator.rb +17 -0
  57. data/lib/generators/sufia/install_generator.rb +8 -3
  58. data/{sufia-models/lib/generators/sufia/models/templates/config/resque_admin.rb → lib/generators/sufia/templates/sufia/stats_admin.rb} +3 -3
  59. data/lib/generators/sufia/upgrade400_generator.rb +2 -2
  60. data/lib/sufia.rb +3 -0
  61. data/lib/sufia/arkivo.rb +11 -0
  62. data/lib/sufia/arkivo/actor.rb +95 -0
  63. data/lib/sufia/arkivo/config.rb +11 -0
  64. data/lib/sufia/arkivo/create_subscription_job.rb +67 -0
  65. data/lib/sufia/arkivo/metadata_munger.rb +51 -0
  66. data/lib/sufia/arkivo/schema_validator.rb +55 -0
  67. data/lib/sufia/form_builder.rb +1 -1
  68. data/lib/sufia/inflections.rb +3 -0
  69. data/lib/sufia/version.rb +1 -1
  70. data/lib/sufia/zotero.rb +6 -0
  71. data/lib/sufia/zotero/config.rb +15 -0
  72. data/solr_conf/conf/solrconfig.xml +11 -0
  73. data/spec/controllers/admin_stats_controller_spec.rb +73 -0
  74. data/spec/controllers/api/items_controller_spec.rb +476 -0
  75. data/spec/controllers/api/zotero_controller_spec.rb +178 -0
  76. data/spec/controllers/batch_edits_controller_spec.rb +7 -0
  77. data/spec/controllers/collections_controller_spec.rb +1 -1
  78. data/spec/controllers/dashboard_controller_spec.rb +1 -1
  79. data/spec/controllers/depositors_controller_spec.rb +9 -5
  80. data/spec/controllers/generic_files_controller_spec.rb +5 -4
  81. data/spec/controllers/mailbox_controller_spec.rb +2 -2
  82. data/spec/controllers/my/collections_controller_spec.rb +1 -2
  83. data/spec/controllers/my/files_controller_spec.rb +5 -5
  84. data/spec/controllers/my/shares_controller_spec.rb +15 -3
  85. data/spec/controllers/pages_controller_spec.rb +1 -1
  86. data/spec/controllers/users_controller_spec.rb +10 -9
  87. data/spec/factories/api_items.rb +91 -0
  88. data/spec/factories/generic_files.rb +4 -0
  89. data/spec/factories/users.rb +4 -4
  90. data/spec/features/featured_item_spec.rb +26 -0
  91. data/spec/features/ingest_upload_files_spec.rb +2 -3
  92. data/spec/features/proxy_spec.rb +0 -1
  93. data/spec/helpers/permissions_helper_spec.rb +2 -2
  94. data/spec/helpers/sufia_helper_spec.rb +11 -5
  95. data/spec/inputs/select_with_help_input_spec.rb +2 -2
  96. data/spec/javascripts/helpers/.gitkeep +0 -0
  97. data/spec/javascripts/helpers/jasmine-jquery.js +832 -0
  98. data/spec/javascripts/jasmine_spec.rb +31 -0
  99. data/spec/javascripts/notify_update_link_spec.js +8 -0
  100. data/spec/javascripts/single_use_link_spec.js.coffee +23 -0
  101. data/spec/javascripts/support/jasmine.yml +124 -0
  102. data/spec/javascripts/support/jasmine_helper.rb +15 -0
  103. data/spec/javascripts/terms_of_service_spec.js.coffee +32 -0
  104. data/spec/javascripts/toggle_icon_spec.js +11 -0
  105. data/spec/jobs/active_fedora_id_based_job_spec.rb +3 -3
  106. data/spec/jobs/import_url_job_spec.rb +0 -2
  107. data/spec/lib/sufia/arkivo/actor_spec.rb +139 -0
  108. data/spec/lib/sufia/arkivo/create_subscription_job_spec.rb +54 -0
  109. data/spec/lib/sufia/arkivo/metadata_munger_spec.rb +48 -0
  110. data/spec/lib/sufia/arkivo/schema_validator_spec.rb +65 -0
  111. data/spec/lib/sufia/upload_complete_behavior_spec.rb +1 -1
  112. data/spec/lib/sufia/user_stat_importer_spec.rb +60 -0
  113. data/spec/lib/sufia/zotero/config_spec.rb +30 -0
  114. data/spec/models/collection_spec.rb +36 -7
  115. data/spec/models/file_download_stat_spec.rb +5 -5
  116. data/spec/models/file_usage_spec.rb +23 -0
  117. data/spec/models/file_view_stat_spec.rb +6 -6
  118. data/spec/models/fits_datastream_spec.rb +0 -5
  119. data/spec/models/generic_file_spec.rb +49 -14
  120. data/spec/models/local_authority_spec.rb +1 -1
  121. data/spec/models/proxy_deposit_request_spec.rb +1 -1
  122. data/spec/models/trophy_spec.rb +8 -8
  123. data/spec/models/user_spec.rb +33 -0
  124. data/spec/presenters/sufia/collection_presenter_spec.rb +1 -1
  125. data/spec/routing/api_route_spec.rb +91 -0
  126. data/spec/routing/route_spec.rb +1 -1
  127. data/spec/services/generic_file_audit_service_spec.rb +44 -8
  128. data/spec/spec_helper.rb +18 -3
  129. data/spec/support/features.rb +0 -2
  130. data/spec/support/locations.rb +0 -21
  131. data/spec/support/rake.rb +41 -0
  132. data/spec/support/selectors.rb +0 -50
  133. data/spec/tasks/rake_spec.rb +33 -12
  134. data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -0
  135. data/spec/views/admin/stats/index.html.erb_spec.rb +45 -0
  136. data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +0 -1
  137. data/spec/views/dashboard/index_spec.rb +1 -1
  138. data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
  139. data/spec/views/generic_file/show.html.erb_spec.rb +1 -3
  140. data/spec/views/users/_follower_modal.html.erb_spec.rb +44 -7
  141. data/spec/views/users/_following_modal.html.erb_spec.rb +49 -7
  142. data/spec/views/users/edit.html.erb_spec.rb +72 -0
  143. data/spec/views/users/show.html.erb_spec.rb +1 -1
  144. data/sufia.gemspec +6 -2
  145. data/tasks/sufia-user.rake +14 -0
  146. metadata +130 -156
  147. data/spec/lib/sufia/id_service_spec.rb +0 -32
  148. data/spec/services/noid_spec.rb +0 -9
  149. data/spec/support/poltergeist.rb +0 -11
  150. data/spec/support/rake_output.rb +0 -20
  151. data/sufia-models/.gitignore +0 -17
  152. data/sufia-models/Gemfile +0 -4
  153. data/sufia-models/LICENSE.md +0 -177
  154. data/sufia-models/README.md +0 -39
  155. data/sufia-models/Rakefile +0 -1
  156. data/sufia-models/app/actors/sufia/generic_file/actor.rb +0 -137
  157. data/sufia-models/app/jobs/active_fedora_id_based_job.rb +0 -22
  158. data/sufia-models/app/jobs/active_fedora_pid_based_job.rb +0 -7
  159. data/sufia-models/app/jobs/audit_job.rb +0 -62
  160. data/sufia-models/app/jobs/batch_update_job.rb +0 -72
  161. data/sufia-models/app/jobs/characterize_job.rb +0 -10
  162. data/sufia-models/app/jobs/create_derivatives_job.rb +0 -14
  163. data/sufia-models/app/jobs/import_url_job.rb +0 -52
  164. data/sufia-models/app/jobs/ingest_local_file_job.rb +0 -46
  165. data/sufia-models/app/jobs/resolrize_job.rb +0 -9
  166. data/sufia-models/app/models/batch.rb +0 -36
  167. data/sufia-models/app/models/checksum_audit_log.rb +0 -21
  168. data/sufia-models/app/models/concerns/sufia/ability.rb +0 -61
  169. data/sufia-models/app/models/concerns/sufia/collection_behavior.rb +0 -24
  170. data/sufia-models/app/models/concerns/sufia/file_stat_utils.rb +0 -35
  171. data/sufia-models/app/models/concerns/sufia/generic_file.rb +0 -25
  172. data/sufia-models/app/models/concerns/sufia/generic_file/batches.rb +0 -28
  173. data/sufia-models/app/models/concerns/sufia/generic_file/characterization.rb +0 -89
  174. data/sufia-models/app/models/concerns/sufia/generic_file/content.rb +0 -13
  175. data/sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb +0 -26
  176. data/sufia-models/app/models/concerns/sufia/generic_file/export.rb +0 -343
  177. data/sufia-models/app/models/concerns/sufia/generic_file/featured.rb +0 -11
  178. data/sufia-models/app/models/concerns/sufia/generic_file/full_text_indexing.rb +0 -43
  179. data/sufia-models/app/models/concerns/sufia/generic_file/indexing.rb +0 -14
  180. data/sufia-models/app/models/concerns/sufia/generic_file/metadata.rb +0 -98
  181. data/sufia-models/app/models/concerns/sufia/generic_file/mime_types.rb +0 -69
  182. data/sufia-models/app/models/concerns/sufia/generic_file/permissions.rb +0 -11
  183. data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +0 -31
  184. data/sufia-models/app/models/concerns/sufia/generic_file/trophies.rb +0 -14
  185. data/sufia-models/app/models/concerns/sufia/generic_file/versions.rb +0 -16
  186. data/sufia-models/app/models/concerns/sufia/generic_file/virus_check.rb +0 -37
  187. data/sufia-models/app/models/concerns/sufia/model_methods.rb +0 -20
  188. data/sufia-models/app/models/concerns/sufia/user.rb +0 -137
  189. data/sufia-models/app/models/concerns/sufia/user_usage_stats.rb +0 -15
  190. data/sufia-models/app/models/datastreams/file_content_datastream.rb +0 -4
  191. data/sufia-models/app/models/datastreams/fits_datastream.rb +0 -152
  192. data/sufia-models/app/models/domain_term.rb +0 -5
  193. data/sufia-models/app/models/featured_work.rb +0 -22
  194. data/sufia-models/app/models/file_download_stat.rb +0 -18
  195. data/sufia-models/app/models/file_usage.rb +0 -34
  196. data/sufia-models/app/models/file_view_stat.rb +0 -18
  197. data/sufia-models/app/models/follow.rb +0 -12
  198. data/sufia-models/app/models/generic_file.rb +0 -3
  199. data/sufia-models/app/models/geo_names_resource.rb +0 -18
  200. data/sufia-models/app/models/group.rb +0 -8
  201. data/sufia-models/app/models/local_authority.rb +0 -86
  202. data/sufia-models/app/models/local_authority_entry.rb +0 -3
  203. data/sufia-models/app/models/proxy_deposit_request.rb +0 -85
  204. data/sufia-models/app/models/proxy_deposit_rights.rb +0 -4
  205. data/sufia-models/app/models/single_use_link.rb +0 -42
  206. data/sufia-models/app/models/subject_local_authority_entry.rb +0 -2
  207. data/sufia-models/app/models/sufia/avatar_uploader.rb +0 -20
  208. data/sufia-models/app/models/sufia/avatar_validator.rb +0 -8
  209. data/sufia-models/app/models/sufia/collection.rb +0 -5
  210. data/sufia-models/app/models/sufia/download.rb +0 -9
  211. data/sufia-models/app/models/sufia/orcid_validator.rb +0 -12
  212. data/sufia-models/app/models/sufia/pageview.rb +0 -9
  213. data/sufia-models/app/models/trophy.rb +0 -10
  214. data/sufia-models/app/models/user_stat.rb +0 -2
  215. data/sufia-models/app/models/version_committer.rb +0 -2
  216. data/sufia-models/app/services/sufia/analytics.rb +0 -50
  217. data/sufia-models/app/services/sufia/generic_file_audit_service.rb +0 -83
  218. data/sufia-models/app/services/sufia/generic_file_indexing_service.rb +0 -12
  219. data/sufia-models/app/services/sufia/id_service.rb +0 -45
  220. data/sufia-models/app/services/sufia/noid.rb +0 -22
  221. data/sufia-models/app/services/sufia/repository_audit_service.rb +0 -9
  222. data/sufia-models/config/locales/sufia.en.yml +0 -6
  223. data/sufia-models/lib/generators/sufia/models/abstract_migration_generator.rb +0 -30
  224. data/sufia-models/lib/generators/sufia/models/cached_stats_generator.rb +0 -24
  225. data/sufia-models/lib/generators/sufia/models/fulltext_generator.rb +0 -27
  226. data/sufia-models/lib/generators/sufia/models/install_generator.rb +0 -106
  227. data/sufia-models/lib/generators/sufia/models/orcid_field_generator.rb +0 -19
  228. data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +0 -24
  229. data/sufia-models/lib/generators/sufia/models/templates/app/models/collection.rb +0 -2
  230. data/sufia-models/lib/generators/sufia/models/templates/config/analytics.yml +0 -9
  231. data/sufia-models/lib/generators/sufia/models/templates/config/clamav.rb +0 -1
  232. data/sufia-models/lib/generators/sufia/models/templates/config/mailboxer.rb +0 -17
  233. data/sufia-models/lib/generators/sufia/models/templates/config/mime_types.rb +0 -6
  234. data/sufia-models/lib/generators/sufia/models/templates/config/redis.yml +0 -9
  235. data/sufia-models/lib/generators/sufia/models/templates/config/redis_config.rb +0 -32
  236. data/sufia-models/lib/generators/sufia/models/templates/config/resque-pool.yml +0 -1
  237. data/sufia-models/lib/generators/sufia/models/templates/config/resque_config.rb +0 -5
  238. data/sufia-models/lib/generators/sufia/models/templates/config/setup_mail.rb +0 -3
  239. data/sufia-models/lib/generators/sufia/models/templates/config/solrconfig.xml +0 -223
  240. data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +0 -144
  241. data/sufia-models/lib/generators/sufia/models/templates/migrations/acts_as_follower_migration.rb +0 -17
  242. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_avatars_to_users.rb +0 -15
  243. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_external_key_to_content_blocks.rb +0 -6
  244. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_groups_to_users.rb +0 -11
  245. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_ldap_attrs_to_user.rb +0 -27
  246. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_linkedin_to_users.rb +0 -5
  247. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_orcid_to_users.rb +0 -5
  248. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_social_to_users.rb +0 -13
  249. data/sufia-models/lib/generators/sufia/models/templates/migrations/change_audit_log_pid_to_generic_file_id.rb +0 -5
  250. data/sufia-models/lib/generators/sufia/models/templates/migrations/change_proxy_deposit_request_pid_to_generic_file_id.rb +0 -5
  251. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_checksum_audit_logs.rb +0 -19
  252. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_content_blocks.rb +0 -10
  253. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_featured_works.rb +0 -12
  254. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_file_download_stats.rb +0 -12
  255. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_file_view_stats.rb +0 -12
  256. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_local_authorities.rb +0 -50
  257. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_requests.rb +0 -16
  258. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_rights.rb +0 -11
  259. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_single_use_links.rb +0 -12
  260. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_tinymce_assets.rb +0 -8
  261. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_trophies.rb +0 -10
  262. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_user_stats.rb +0 -19
  263. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_version_committers.rb +0 -15
  264. data/sufia-models/lib/generators/sufia/models/update_content_blocks_generator.rb +0 -18
  265. data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +0 -54
  266. data/sufia-models/lib/generators/sufia/models/upgrade600_generator.rb +0 -21
  267. data/sufia-models/lib/generators/sufia/models/usagestats_generator.rb +0 -19
  268. data/sufia-models/lib/generators/sufia/models/user_stats_generator.rb +0 -31
  269. data/sufia-models/lib/sufia/messages.rb +0 -66
  270. data/sufia-models/lib/sufia/models.rb +0 -34
  271. data/sufia-models/lib/sufia/models/active_fedora/redis.rb +0 -43
  272. data/sufia-models/lib/sufia/models/active_record/redis.rb +0 -56
  273. data/sufia-models/lib/sufia/models/engine.rb +0 -79
  274. data/sufia-models/lib/sufia/models/file_content.rb +0 -6
  275. data/sufia-models/lib/sufia/models/file_content/versions.rb +0 -21
  276. data/sufia-models/lib/sufia/models/resque.rb +0 -36
  277. data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +0 -108
  278. data/sufia-models/lib/sufia/models/user_local_directory_behavior.rb +0 -29
  279. data/sufia-models/lib/sufia/models/utils.rb +0 -22
  280. data/sufia-models/lib/sufia/models/version.rb +0 -5
  281. data/sufia-models/lib/sufia/models/virus_found_error.rb +0 -4
  282. data/sufia-models/lib/sufia/permissions.rb +0 -9
  283. data/sufia-models/lib/sufia/permissions/readable.rb +0 -20
  284. data/sufia-models/lib/sufia/permissions/writable.rb +0 -74
  285. data/sufia-models/lib/tasks/batch_cleanup.rake +0 -19
  286. data/sufia-models/lib/tasks/migrate.rake +0 -21
  287. data/sufia-models/lib/tasks/resque.rake +0 -13
  288. data/sufia-models/lib/tasks/stats_tasks.rake +0 -12
  289. data/sufia-models/lib/tasks/sufia-models_tasks.rake +0 -80
  290. data/sufia-models/sufia-models.gemspec +0 -52
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ # Run the jasmine tests by running the jasmine:ci rake command and capturing the output
4
+ # The spec will fail if any jasmine tests fails
5
+ #
6
+ # If you have a jasmine syntax error the test will fail since there will not be zero failures
7
+ #
8
+ # If you add a new jasmine test by adding a file to spec/javascripts/*spec.js* make sure the
9
+ # number of test run increments or you may have a syntax error inside your jasmine test
10
+ #
11
+ describe "Jasmine" do
12
+ it "expects all jasmine tests to pass" do
13
+ load_rake_environment ["#{jasmine_path}/lib/jasmine/tasks/jasmine.rake"]
14
+ jasmine_out = run_task 'jasmine:ci'
15
+ unless jasmine_out.include? "0 failures"
16
+ puts "\n\n************************ Jasmine Output *************"
17
+ puts jasmine_out
18
+ puts "************************ Jasmine Output *************\n\n"
19
+ else
20
+ js_specs_count = Dir['spec/javascripts/**/*_spec.js*'].count
21
+ puts "#{jasmine_out.match(/\n(.+) specs/)[1]} jasmine specs run (in #{js_specs_count} jasmine test files)"
22
+ end
23
+ expect(jasmine_out).to include "0 failures"
24
+ expect(jasmine_out).to_not include "\n0 specs"
25
+ end
26
+
27
+ end
28
+
29
+ def jasmine_path
30
+ Gem.loaded_specs['jasmine'].full_gem_path
31
+ end
@@ -0,0 +1,8 @@
1
+ describe("notify update link", function() {
2
+ it("clicks the link", function(){
3
+ setFixtures('<div id="notify_update_link"></div>')
4
+ spyEvent = spyOnEvent('#notify_update_link', 'click');
5
+ notify_update_link();
6
+ expect(spyEvent).toHaveBeenTriggered();
7
+ });
8
+ });
@@ -0,0 +1,23 @@
1
+ describe "single use link", ->
2
+
3
+ # call ajax to get a link
4
+ it "calls for the expected link", ->
5
+ # set up mock and response
6
+ resp = responseText: "/single_use_linkabc123"
7
+ options = {
8
+ headers:
9
+ Accept: 'application/javascript'
10
+ type: 'get'
11
+ url: "#{window.location.protocol}//#{window.location.host}/single_use_link/generate_show/abc123"
12
+ async: false
13
+ }
14
+ se = spyOn($, "ajax").and.returnValue resp
15
+
16
+ # get the single use link
17
+ result = getSingleUse "copy_link_abc123"
18
+
19
+ #verify the result
20
+ expect(result).toEqual "#{window.location.protocol}//#{window.location.host}/single_use_linkabc123"
21
+
22
+ # verify the options sent to the ajax call
23
+ expect(se).toHaveBeenCalledWith(options)
@@ -0,0 +1,124 @@
1
+ # src_files
2
+ #
3
+ # Return an array of filepaths relative to src_dir to include before jasmine specs.
4
+ # Default: []
5
+ #
6
+ # EXAMPLE:
7
+ #
8
+ # src_files:
9
+ # - lib/source1.js
10
+ # - lib/source2.js
11
+ # - dist/**/*.js
12
+ #
13
+ src_files:
14
+ - assets/application.js
15
+
16
+ # stylesheets
17
+ #
18
+ # Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
19
+ # Default: []
20
+ #
21
+ # EXAMPLE:
22
+ #
23
+ # stylesheets:
24
+ # - css/style.css
25
+ # - stylesheets/*.css
26
+ #
27
+ stylesheets:
28
+ - assets/application.css
29
+
30
+ # helpers
31
+ #
32
+ # Return an array of filepaths relative to spec_dir to include before jasmine specs.
33
+ # Default: ["helpers/**/*.js"]
34
+ #
35
+ # EXAMPLE:
36
+ #
37
+ # helpers:
38
+ # - helpers/**/*.js
39
+ #
40
+ helpers:
41
+ - 'helpers/**/*.js'
42
+
43
+ # spec_files
44
+ #
45
+ # Return an array of filepaths relative to spec_dir to include.
46
+ # Default: ["**/*[sS]pec.js"]
47
+ #
48
+ # EXAMPLE:
49
+ #
50
+ # spec_files:
51
+ # - **/*[sS]pec.js
52
+ #
53
+ spec_files:
54
+ - '**/*[sS]pec.js*'
55
+
56
+ # src_dir
57
+ #
58
+ # Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
59
+ # Default: project root
60
+ #
61
+ # EXAMPLE:
62
+ #
63
+ # src_dir: public
64
+ #
65
+ src_dir:
66
+
67
+ # spec_dir
68
+ #
69
+ # Spec directory path. Your spec_files must be returned relative to this path.
70
+ # Default: spec/javascripts
71
+ #
72
+ # EXAMPLE:
73
+ #
74
+ # spec_dir: spec/javascripts
75
+ #
76
+ spec_dir:
77
+
78
+ # spec_helper
79
+ #
80
+ # Ruby file that Jasmine server will require before starting.
81
+ # Returned relative to your root path
82
+ # Default spec/javascripts/support/jasmine_helper.rb
83
+ #
84
+ # EXAMPLE:
85
+ #
86
+ # spec_helper: spec/javascripts/support/jasmine_helper.rb
87
+ #
88
+ spec_helper: spec/javascripts/support/jasmine_helper.rb
89
+
90
+ # boot_dir
91
+ #
92
+ # Boot directory path. Your boot_files must be returned relative to this path.
93
+ # Default: Built in boot file
94
+ #
95
+ # EXAMPLE:
96
+ #
97
+ # boot_dir: spec/javascripts/support/boot
98
+ #
99
+ boot_dir:
100
+
101
+ # boot_files
102
+ #
103
+ # Return an array of filepaths relative to boot_dir to include in order to boot Jasmine
104
+ # Default: Built in boot file
105
+ #
106
+ # EXAMPLE
107
+ #
108
+ # boot_files:
109
+ # - '**/*.js'
110
+ #
111
+ boot_files:
112
+
113
+ # rack_options
114
+ #
115
+ # Extra options to be passed to the rack server
116
+ # by default, Port and AccessLog are passed.
117
+ #
118
+ # This is an advanced options, and left empty by default
119
+ #
120
+ # EXAMPLE
121
+ #
122
+ # rack_options:
123
+ # server: 'thin'
124
+
@@ -0,0 +1,15 @@
1
+ #Use this file to set/override Jasmine configuration options
2
+ #You can remove it if you don't need it.
3
+ #This file is loaded *after* jasmine.yml is interpreted.
4
+ #
5
+ #Example: using a different boot file.
6
+ #Jasmine.configure do |config|
7
+ # config.boot_dir = '/absolute/path/to/boot_dir'
8
+ # config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
9
+ #end
10
+ #
11
+ #Example: prevent PhantomJS auto install, uses PhantomJS already on your path.
12
+ #Jasmine.configure do |config|
13
+ # config.prevent_phantom_js_auto_install = true
14
+ #end
15
+ #
@@ -0,0 +1,32 @@
1
+ describe "terms of service", ->
2
+ beforeEach ->
3
+ # setup a simple form with a checkbox and a button tomimic the upload forms
4
+ setFixtures '<input id="check" type="checkbox" data-activate="activate-submit"><input><div id="div1" class="activate-container" data-toggle="tooltip"><button type="submit" class="activate-submit"></button></div>'
5
+
6
+ # call all the Blacklight.onLoad functions
7
+ Blacklight.activate()
8
+
9
+
10
+ # no submit button unless activate-submit is checked
11
+ it "submit is disabled by default", ->
12
+ expect($('.activate-submit')).toBeDisabled()
13
+
14
+ # shows tooltip until active-submit is checked
15
+ it "shows the tooltip by defualt", ->
16
+ se = spyOn $.fn, 'tooltip' # spy on tooltip call
17
+ $('.activate-container').trigger('mousemove')
18
+ expect(se).toHaveBeenCalledWith 'show'
19
+
20
+ describe "when checked", ->
21
+ # agree to the terms of service
22
+ beforeEach ->
23
+ $('#check').trigger('click')
24
+
25
+ it "activates submit when clicked", ->
26
+ expect($('.activate-submit')).not.toBeDisabled()
27
+
28
+ it "does not show the tooltip after checked", ->
29
+ se = spyOn $.fn, 'tooltip' # spy on tooltip call
30
+ $('.activate-container').trigger('mousemove')
31
+ expect(se).toHaveBeenCalledWith 'hide'
32
+
@@ -0,0 +1,11 @@
1
+
2
+ describe("toggle icon", function() {
3
+ it("toggles the caret", function(){
4
+ setFixtures('<div id="icon" class="caret"></div>')
5
+ toggle_icon($("#icon"));
6
+ expect($("#icon")).toHaveClass("caret up")
7
+ toggle_icon($("#icon"));
8
+ expect($("#icon")).not.toHaveClass("caret up")
9
+ expect($("#icon")).toHaveClass("caret")
10
+ });
11
+ });
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedoraIdBasedJob do
4
- let (:user) {FactoryGirl.find_or_create(:jill)}
5
- let (:file) {GenericFile.new.tap do |gf|
4
+ let(:user) { FactoryGirl.find_or_create(:jill) }
5
+ let(:file) { GenericFile.new.tap do |gf|
6
6
  gf.apply_depositor_metadata(user)
7
7
  gf.save!
8
- end}
8
+ end }
9
9
 
10
10
  it "finds object" do
11
11
  job = ActiveFedoraIdBasedJob.new(file.id)
@@ -51,10 +51,8 @@ describe ImportUrlJob do
51
51
 
52
52
  context "when the file has a virus" do
53
53
  before do
54
- s1 = double('content deposit event')
55
54
  allow(ContentDepositEventJob).to receive(:new).with(generic_file.id, 'jilluser@example.com').never
56
55
 
57
- s2 = double('characterize')
58
56
  allow(CharacterizeJob).to receive(:new).with(generic_file.id).never
59
57
  end
60
58
  it "should abort if virus check fails" do
@@ -0,0 +1,139 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sufia::Arkivo::Actor do
4
+ before do
5
+ # Don't test characterization on these items; it breaks TravisCI
6
+ allow_any_instance_of(GenericFile).to receive(:characterize)
7
+ end
8
+
9
+ subject { described_class.new(user, item) }
10
+
11
+ let(:user) { FactoryGirl.find_or_create(:archivist) }
12
+ let(:item) { JSON.parse(FactoryGirl.json(:post_item)) }
13
+
14
+ describe 'Tempfile monkey-patches' do
15
+ subject { Tempfile.new('foo') }
16
+
17
+ it { is_expected.to respond_to(:original_filename) }
18
+ it { is_expected.to respond_to(:original_filename=) }
19
+ it { is_expected.to respond_to(:content_type) }
20
+ it { is_expected.to respond_to(:content_type=) }
21
+ end
22
+
23
+ describe '#create_file_from_item' do
24
+ it { is_expected.to respond_to(:create_file_from_item) }
25
+
26
+ it 'creates a batch for loading metadata' do
27
+ expect { subject.create_file_from_item }.to change { Batch.count }.by(1)
28
+ end
29
+
30
+ it 'instantiates an actor' do
31
+ expect(Sufia::GenericFile::Actor).to receive(:new).once.and_call_original
32
+ subject.create_file_from_item
33
+ end
34
+
35
+ it 'creates initial metadata' do
36
+ expect_any_instance_of(Sufia::GenericFile::Actor).to receive(:create_metadata).once
37
+ subject.create_file_from_item
38
+ end
39
+
40
+ it 'stores a checksum' do
41
+ gf = subject.create_file_from_item
42
+ expect(gf.arkivo_checksum).to eq item['file']['md5']
43
+ end
44
+
45
+ it 'calls create_content' do
46
+ expect_any_instance_of(Sufia::GenericFile::Actor).to receive(:create_content).once
47
+ subject.create_file_from_item
48
+ end
49
+
50
+ it 'extracts a file from the item' do
51
+ gf = subject.create_file_from_item
52
+ expect(gf.content.content).to eq "arkivo\n"
53
+ end
54
+
55
+ it 'batch applies metadata' do
56
+ gf = subject.create_file_from_item
57
+ # TODO: Figure out why this is needed if the Resque job is running synchronously
58
+ reloaded = gf.reload
59
+ expect(reloaded.title).to eq Array(item['metadata']['title'])
60
+ end
61
+
62
+ it 'returns a GF instance' do
63
+ expect(subject.create_file_from_item).to be_instance_of(GenericFile)
64
+ end
65
+ end
66
+
67
+ describe '#update_file_from_item' do
68
+ let(:item) { JSON.parse(FactoryGirl.json(:put_item)) }
69
+ let(:title) { ['ZZZZZ'] }
70
+ let(:description) { ['This is rather lengthy.'] }
71
+ let(:checksum) { 'abc123' }
72
+ let(:gf) do
73
+ GenericFile.create(title: title, description: description) do |f|
74
+ f.apply_depositor_metadata(user.user_key)
75
+ f.arkivo_checksum = checksum
76
+ end
77
+ end
78
+
79
+ it { is_expected.to respond_to(:update_file_from_item) }
80
+
81
+ it 'instantiates an actor' do
82
+ expect(Sufia::GenericFile::Actor).to receive(:new).once.and_call_original
83
+ subject.update_file_from_item(gf)
84
+ end
85
+
86
+ describe '#reset_metadata' do
87
+ it 'changes the title' do
88
+ # For some reason, "expect to change from to" wasn't working here
89
+ expect(gf.title).to eq title
90
+ subject.update_file_from_item(gf)
91
+ expect(gf.title).to eq Array(item['metadata']['title'])
92
+ end
93
+
94
+ it 'wipes out the description' do
95
+ # For some reason, "expect to change from to" wasn't working here
96
+ expect(gf.description).to eq description
97
+ subject.update_file_from_item(gf)
98
+ expect(gf.description).to eq []
99
+ end
100
+ end
101
+
102
+ it 'changes the arkivo checksum' do
103
+ expect {
104
+ subject.update_file_from_item(gf)
105
+ }.to change { gf.arkivo_checksum }.from(checksum).to(item['file']['md5'])
106
+ end
107
+
108
+ it 'calls update_content' do
109
+ expect_any_instance_of(Sufia::GenericFile::Actor).to receive(:update_content).once
110
+ subject.update_file_from_item(gf)
111
+ end
112
+
113
+ it 'extracts a file from the item' do
114
+ expect {
115
+ subject.update_file_from_item(gf)
116
+ }.to change { gf.content.content }.to("# HEADER\n\nThis is a paragraph!\n")
117
+ end
118
+
119
+ it 'returns a GF instance' do
120
+ expect(subject.update_file_from_item(gf)).to be_instance_of(GenericFile)
121
+ end
122
+ end
123
+
124
+ describe '#destroy_file' do
125
+ let(:gf) do
126
+ GenericFile.create do |f|
127
+ f.apply_depositor_metadata(user.user_key)
128
+ end
129
+ end
130
+
131
+ it { is_expected.to respond_to(:destroy_file) }
132
+
133
+ it 'deletes the file' do
134
+ expect {
135
+ subject.destroy_file(gf)
136
+ }.to change { gf.destroyed? }.from(nil).to(true)
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sufia::Arkivo::CreateSubscriptionJob do
4
+ let(:user) { FactoryGirl.find_or_create(:archivist) }
5
+
6
+ subject { described_class.new(user.user_key) }
7
+
8
+ context 'with a bogus user' do
9
+ before { allow(User).to receive(:find_by_user_key) { nil } }
10
+ it 'raises because user not found' do
11
+ expect { subject.run }.to raise_error(Sufia::Arkivo::SubscriptionError, 'User not found')
12
+ end
13
+ end
14
+
15
+ context 'without an arkivo token' do
16
+ before { allow_any_instance_of(User).to receive(:arkivo_token) { nil } }
17
+ it 'raises because user lacks arkivo token' do
18
+ expect { subject.run }.to raise_error(Sufia::Arkivo::SubscriptionError, 'User does not have an Arkivo token')
19
+ end
20
+ end
21
+
22
+ context 'without a zotero userid' do
23
+ it 'raises because user did not oauth' do
24
+ expect { subject.run }.to raise_error(Sufia::Arkivo::SubscriptionError, 'User has not yet connected with Zotero')
25
+ end
26
+ end
27
+
28
+ context 'with an existing subscription' do
29
+ before do
30
+ allow_any_instance_of(User).to receive(:zotero_userid) { '45352' }
31
+ allow_any_instance_of(User).to receive(:arkivo_subscription) { 'http://localhost/foo/bar' }
32
+ end
33
+
34
+ it 'raises because user already has subscription' do
35
+ expect { subject.run }.to raise_error(Sufia::Arkivo::SubscriptionError, 'User already has a subscription')
36
+ end
37
+ end
38
+
39
+ context 'when expected to succeed' do
40
+ before do
41
+ allow_any_instance_of(User).to receive(:zotero_userid) { '45352' }
42
+ allow(subject).to receive(:post_to_api) { response }
43
+ end
44
+
45
+ let(:response) { double('response', headers: { 'Location' => subscription_uri }) }
46
+ let(:subscription_uri) { '/api/subscription/abcxyz1234' }
47
+
48
+ it 'stores a subscription URL for possible later invalidation' do
49
+ expect(user.arkivo_subscription).to be_blank
50
+ subject.run
51
+ expect(user.reload.arkivo_subscription).to eq subscription_uri
52
+ end
53
+ end
54
+ end