hydra-head 4.1.3 → 5.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (412) hide show
  1. metadata +28 -617
  2. data/.gitignore +0 -73
  3. data/.gitmodules +0 -4
  4. data/Gemfile +0 -14
  5. data/HISTORY.textile +0 -99
  6. data/INSTALL_PREREQ.textile +0 -3
  7. data/LICENSE +0 -14
  8. data/README.textile +0 -129
  9. data/Rakefile +0 -5
  10. data/app/assets/images/hydra/powered_by_hydra.png +0 -0
  11. data/app/assets/images/hydra/search-button.png +0 -0
  12. data/app/assets/javascripts/date-picker/booking/index.html +0 -368
  13. data/app/assets/javascripts/date-picker/calendarHTML.txt +0 -84
  14. data/app/assets/javascripts/date-picker/css/datepicker.css +0 -511
  15. data/app/assets/javascripts/date-picker/css/demo.css +0 -229
  16. data/app/assets/javascripts/date-picker/index.html +0 -798
  17. data/app/assets/javascripts/date-picker/js/datepicker.js +0 -2898
  18. data/app/assets/javascripts/date-picker/js/datepicker.packed.js +0 -1
  19. data/app/assets/javascripts/date-picker/js/lang/ar.js +0 -9
  20. data/app/assets/javascripts/date-picker/js/lang/cs.js +0 -9
  21. data/app/assets/javascripts/date-picker/js/lang/da.js +0 -10
  22. data/app/assets/javascripts/date-picker/js/lang/de.js +0 -10
  23. data/app/assets/javascripts/date-picker/js/lang/en.js +0 -9
  24. data/app/assets/javascripts/date-picker/js/lang/eo.js +0 -13
  25. data/app/assets/javascripts/date-picker/js/lang/es.js +0 -9
  26. data/app/assets/javascripts/date-picker/js/lang/et.js +0 -23
  27. data/app/assets/javascripts/date-picker/js/lang/fi.js +0 -7
  28. data/app/assets/javascripts/date-picker/js/lang/fr.js +0 -69
  29. data/app/assets/javascripts/date-picker/js/lang/he.js +0 -9
  30. data/app/assets/javascripts/date-picker/js/lang/hu.js +0 -9
  31. data/app/assets/javascripts/date-picker/js/lang/id.js +0 -9
  32. data/app/assets/javascripts/date-picker/js/lang/it.js +0 -11
  33. data/app/assets/javascripts/date-picker/js/lang/kr.js +0 -9
  34. data/app/assets/javascripts/date-picker/js/lang/lt.js +0 -8
  35. data/app/assets/javascripts/date-picker/js/lang/lv.js +0 -9
  36. data/app/assets/javascripts/date-picker/js/lang/nl.js +0 -9
  37. data/app/assets/javascripts/date-picker/js/lang/no.js +0 -9
  38. data/app/assets/javascripts/date-picker/js/lang/pl.js +0 -10
  39. data/app/assets/javascripts/date-picker/js/lang/pt-br.js +0 -11
  40. data/app/assets/javascripts/date-picker/js/lang/pt.js +0 -9
  41. data/app/assets/javascripts/date-picker/js/lang/ru.js +0 -11
  42. data/app/assets/javascripts/date-picker/js/lang/se.js +0 -9
  43. data/app/assets/javascripts/date-picker/js/lang/si.js +0 -9
  44. data/app/assets/javascripts/date-picker/js/lang/tr.js +0 -9
  45. data/app/assets/javascripts/date-picker/language/index.html +0 -240
  46. data/app/assets/javascripts/date-picker/media/Thumbs.db +0 -0
  47. data/app/assets/javascripts/date-picker/media/backstripes.gif +0 -0
  48. data/app/assets/javascripts/date-picker/media/bg_header.jpg +0 -0
  49. data/app/assets/javascripts/date-picker/media/bullet1.gif +0 -0
  50. data/app/assets/javascripts/date-picker/media/bullet2.gif +0 -0
  51. data/app/assets/javascripts/date-picker/media/cal-grey.gif +0 -0
  52. data/app/assets/javascripts/date-picker/media/cal.gif +0 -0
  53. data/app/assets/javascripts/date-picker/media/gradient-e5e5e5-ffffff.gif +0 -0
  54. data/app/assets/javascripts/hydra/hydra-head.js +0 -195
  55. data/app/assets/javascripts/hydra/mediashelf.datepicker.js +0 -39
  56. data/app/assets/javascripts/hydra/mediashelf.placeholder.js +0 -67
  57. data/app/assets/javascripts/jquery.form.js +0 -1076
  58. data/app/assets/javascripts/jquery.ui.datepicker.js +0 -1793
  59. data/app/assets/javascripts/spin.min.js +0 -2
  60. data/app/assets/stylesheets/hydra/html_refactor.css +0 -79
  61. data/app/assets/stylesheets/hydra/hydrangea-split-button.css +0 -18
  62. data/app/assets/stylesheets/hydra/hydrangea.css +0 -288
  63. data/app/assets/stylesheets/hydra/ie-styles.css +0 -149
  64. data/app/assets/stylesheets/hydra/styles.css +0 -946
  65. data/app/assets/stylesheets/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  66. data/app/assets/stylesheets/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  67. data/app/assets/stylesheets/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  68. data/app/assets/stylesheets/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  69. data/app/assets/stylesheets/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  70. data/app/assets/stylesheets/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  71. data/app/assets/stylesheets/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  72. data/app/assets/stylesheets/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  73. data/app/assets/stylesheets/redmond/images/ui-icons_217bc0_256x240.png +0 -0
  74. data/app/assets/stylesheets/redmond/images/ui-icons_2e83ff_256x240.png +0 -0
  75. data/app/assets/stylesheets/redmond/images/ui-icons_469bdd_256x240.png +0 -0
  76. data/app/assets/stylesheets/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
  77. data/app/assets/stylesheets/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
  78. data/app/assets/stylesheets/redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
  79. data/app/assets/stylesheets/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
  80. data/app/assets/stylesheets/redmond/jquery-ui-1.8.5.custom.css +0 -572
  81. data/app/controllers/downloads_controller.rb +0 -20
  82. data/app/controllers/hydra/application_controller.rb +0 -5
  83. data/app/controllers/hydra/assets_controller.rb +0 -12
  84. data/app/controllers/hydra/contributors_controller.rb +0 -115
  85. data/app/controllers/hydra/file_assets_controller.rb +0 -3
  86. data/app/controllers/hydra/permissions_controller.rb +0 -117
  87. data/app/controllers/user_sessions_controller.rb +0 -13
  88. data/app/helpers/application_helper.rb +0 -3
  89. data/app/helpers/article_metadata_helper.rb +0 -4
  90. data/app/helpers/blacklight_helper.rb +0 -4
  91. data/app/helpers/downloads_helper.rb +0 -4
  92. data/app/helpers/facets_helper.rb +0 -4
  93. data/app/helpers/generic_content_objects_helper.rb +0 -4
  94. data/app/helpers/hydra/application_helper_behavior.rb +0 -8
  95. data/app/helpers/hydra/article_metadata_helper_behavior.rb +0 -95
  96. data/app/helpers/hydra/blacklight_helper_behavior.rb +0 -128
  97. data/app/helpers/hydra/downloads_helper_behavior.rb +0 -24
  98. data/app/helpers/hydra/facets_helper_behavior.rb +0 -34
  99. data/app/helpers/hydra/generic_content_objects_helper_behavior.rb +0 -17
  100. data/app/helpers/hydra/hydra_assets_helper_behavior.rb +0 -76
  101. data/app/helpers/hydra/hydra_fedora_metadata_helper_behavior.rb +0 -379
  102. data/app/helpers/hydra/hydra_helper_behavior.rb +0 -195
  103. data/app/helpers/hydra/hydra_uploader_helper_behavior.rb +0 -23
  104. data/app/helpers/hydra/inline_editable_metadata_helper_behavior.rb +0 -21
  105. data/app/helpers/hydra/javascript_includes_helper_behavior.rb +0 -94
  106. data/app/helpers/hydra/personalization_helper_behavior.rb +0 -49
  107. data/app/helpers/hydra/release_process_helper_behavior.rb +0 -37
  108. data/app/helpers/hydra_assets_helper.rb +0 -4
  109. data/app/helpers/hydra_fedora_metadata_helper.rb +0 -4
  110. data/app/helpers/hydra_helper.rb +0 -4
  111. data/app/helpers/hydra_uploader_helper.rb +0 -4
  112. data/app/helpers/inline_editable_metadata_helper.rb +0 -4
  113. data/app/helpers/javascript_includes_helper.rb +0 -4
  114. data/app/helpers/personalization_helper.rb +0 -4
  115. data/app/helpers/release_process_helper.rb +0 -4
  116. data/app/models/file_asset.rb +0 -5
  117. data/app/models/generic_content.rb +0 -26
  118. data/app/models/generic_image.rb +0 -67
  119. data/app/models/hydra/datastream/properties.rb +0 -24
  120. data/app/models/mods_asset.rb +0 -24
  121. data/app/models/superuser.rb +0 -14
  122. data/app/models/user_attribute.rb +0 -37
  123. data/app/models/uses_default_partials.rb +0 -23
  124. data/app/views/_add_assets_links.html.erb +0 -14
  125. data/app/views/_flash_msg.html.erb +0 -5
  126. data/app/views/_user_util_links.html.erb +0 -31
  127. data/app/views/catalog/_citation.html.erb +0 -11
  128. data/app/views/catalog/_constraints_element.html.erb +0 -34
  129. data/app/views/catalog/_delete_partials/_default.html.erb +0 -22
  130. data/app/views/catalog/_document_list.html.erb +0 -11
  131. data/app/views/catalog/_edit_partials/_default.html.erb +0 -57
  132. data/app/views/catalog/_edit_partials/_default_details.html.erb +0 -13
  133. data/app/views/catalog/_facets.html.erb +0 -37
  134. data/app/views/catalog/_home.html.erb +0 -6
  135. data/app/views/catalog/_home_text.html.erb +0 -4
  136. data/app/views/catalog/_index_partials/_default.html.erb +0 -20
  137. data/app/views/catalog/_index_partials/_default_details.html.erb +0 -14
  138. data/app/views/catalog/_index_partials/_default_group.html.erb +0 -15
  139. data/app/views/catalog/_opensearch_response_metadata.html.erb +0 -2
  140. data/app/views/catalog/_show_partials/_default.html.erb +0 -21
  141. data/app/views/catalog/_show_partials/_default_details.html.erb +0 -15
  142. data/app/views/catalog/_show_partials/_facets.html.erb +0 -52
  143. data/app/views/catalog/_sms_form.html.erb +0 -21
  144. data/app/views/catalog/_sort_and_per_page.html.erb +0 -23
  145. data/app/views/catalog/_uva_tabs.html.erb +0 -10
  146. data/app/views/catalog/about.html.erb +0 -0
  147. data/app/views/catalog/show.html.erb +0 -40
  148. data/app/views/contributors/_add_contributor_split_button.html.erb +0 -10
  149. data/app/views/contributors/_edit_conference.html.erb +0 -29
  150. data/app/views/contributors/_edit_organization.html.erb +0 -29
  151. data/app/views/contributors/_edit_person.html.erb +0 -39
  152. data/app/views/contributors/_index.html.erb +0 -11
  153. data/app/views/contributors/_new.html.erb +0 -10
  154. data/app/views/contributors/_show_conference.html.erb +0 -12
  155. data/app/views/contributors/_show_organization.html.erb +0 -21
  156. data/app/views/contributors/_show_person.html.erb +0 -17
  157. data/app/views/contributors/new.html.erb +0 -14
  158. data/app/views/downloads/index.html.erb +0 -1
  159. data/app/views/generic_content_objects/_contributor_form.html.erb +0 -11
  160. data/app/views/generic_content_objects/_description_form.html.erb +0 -7
  161. data/app/views/generic_content_objects/_edit_description.html.erb +0 -23
  162. data/app/views/generic_content_objects/_new.html.erb +0 -0
  163. data/app/views/generic_content_objects/_show_description.html.erb +0 -41
  164. data/app/views/generic_contents/_edit.html.erb +0 -10
  165. data/app/views/generic_contents/_index.html.erb +0 -21
  166. data/app/views/generic_contents/_show.html.erb +0 -6
  167. data/app/views/generic_contents/_show_content.html.erb +0 -7
  168. data/app/views/generic_images/_edit.html.erb +0 -36
  169. data/app/views/generic_images/_index.html.erb +0 -24
  170. data/app/views/generic_images/_show.html.erb +0 -13
  171. data/app/views/generic_images/_show_all.html.erb +0 -14
  172. data/app/views/generic_images/_show_content.html.erb +0 -7
  173. data/app/views/hydra/file_assets/_asset_saved_flash.html.erb +0 -2
  174. data/app/views/hydra/file_assets/_deletable_result.html.erb +0 -5
  175. data/app/views/hydra/file_assets/_file_assets_form.html.erb +0 -11
  176. data/app/views/hydra/file_assets/_index.html.erb +0 -29
  177. data/app/views/hydra/file_assets/_new.html.erb +0 -6
  178. data/app/views/hydra/file_assets/_result.html.erb +0 -11
  179. data/app/views/hydra/file_assets/index.html.erb +0 -5
  180. data/app/views/hydra/permissions/_edit_person_permissions.html.erb +0 -30
  181. data/app/views/hydra/permissions/_index.html.erb +0 -46
  182. data/app/views/hydra/permissions/_new.html.erb +0 -14
  183. data/app/views/hydra/permissions/_permissions_form.html.erb +0 -23
  184. data/app/views/hydra/permissions/index.html.erb +0 -1
  185. data/app/views/hydra/permissions/new.html.erb +0 -1
  186. data/app/views/layouts/hydra-head.html.erb +0 -47
  187. data/app/views/mods_assets/_additional_info_form.html.erb +0 -44
  188. data/app/views/mods_assets/_contributor_form.html.erb +0 -14
  189. data/app/views/mods_assets/_edit.html.erb +0 -10
  190. data/app/views/mods_assets/_edit_description.html.erb +0 -73
  191. data/app/views/mods_assets/_edit_journal.html.erb +0 -57
  192. data/app/views/mods_assets/_index.html.erb +0 -1
  193. data/app/views/mods_assets/_index_list.html.erb +0 -37
  194. data/app/views/mods_assets/_index_table.html.erb +0 -7
  195. data/app/views/mods_assets/_progress_box.html.erb +0 -82
  196. data/app/views/mods_assets/_publication_form.html.erb +0 -13
  197. data/app/views/mods_assets/_show.html.erb +0 -39
  198. data/app/views/mods_assets/_show_additional_info.html.erb +0 -17
  199. data/app/views/mods_assets/_show_contributors.html.erb +0 -7
  200. data/app/views/mods_assets/_show_description.html.erb +0 -35
  201. data/app/views/mods_assets/_show_file_assets.html.erb +0 -22
  202. data/app/views/mods_assets/_show_journal.html.erb +0 -42
  203. data/app/views/mods_assets/_show_permissions.html.erb +0 -15
  204. data/app/views/mods_assets/_show_publication.html.erb +0 -8
  205. data/app/views/shared/_delete_asset_confirmation.html.erb +0 -17
  206. data/app/views/user_sessions/_login_form.html.erb +0 -10
  207. data/app/views/user_sessions/logged_out.html.erb +0 -1
  208. data/config/fedora.yml +0 -15
  209. data/config/jetty.yml +0 -6
  210. data/config/locales/hydra.en.yml +0 -7
  211. data/config/role_map_cucumber.yml +0 -10
  212. data/config/role_map_development.yml +0 -12
  213. data/config/role_map_production.yml +0 -2
  214. data/config/role_map_test.yml +0 -14
  215. data/config/routes.rb +0 -12
  216. data/config/solr.yml +0 -9
  217. data/config/solr_mappings.yml +0 -22
  218. data/db/migrate/20101105214243_add_user_attributes_table.rb +0 -15
  219. data/db/migrate/20101108192527_create_superusers.rb +0 -12
  220. data/fedora_conf/conf/development/fedora.fcfg +0 -1021
  221. data/fedora_conf/conf/test/fedora.fcfg +0 -1021
  222. data/hydra-head.gemspec +0 -41
  223. data/init.rb +0 -4
  224. data/install.rb +0 -1
  225. data/lib/application_helper.rb +0 -3
  226. data/lib/generators/hydra/assets_generator.rb +0 -50
  227. data/lib/generators/hydra/cucumber_support_generator.rb +0 -29
  228. data/lib/generators/hydra/head_generator.rb +0 -165
  229. data/lib/generators/hydra/hyhead_fixtures_generator.rb +0 -27
  230. data/lib/generators/hydra/templates/catalog_controller.rb +0 -162
  231. data/lib/generators/hydra/templates/config/fedora.yml +0 -14
  232. data/lib/generators/hydra/templates/config/initializers/action_dispatch_http_upload_monkey_patch.rb +0 -12
  233. data/lib/generators/hydra/templates/config/initializers/hydra_config.rb +0 -44
  234. data/lib/generators/hydra/templates/config/role_map_cucumber.yml +0 -10
  235. data/lib/generators/hydra/templates/config/role_map_development.yml +0 -12
  236. data/lib/generators/hydra/templates/config/role_map_production.yml +0 -2
  237. data/lib/generators/hydra/templates/config/role_map_test.yml +0 -15
  238. data/lib/generators/hydra/templates/config/solr.yml +0 -10
  239. data/lib/generators/hydra/templates/config/solr_mappings.yml +0 -22
  240. data/lib/generators/hydra/templates/fedora_conf/conf/development/fedora.fcfg +0 -1021
  241. data/lib/generators/hydra/templates/fedora_conf/conf/test/fedora.fcfg +0 -1021
  242. data/lib/generators/hydra/templates/migrations/create_superusers.rb +0 -12
  243. data/lib/generators/hydra/templates/solr_conf/conf/schema.xml +0 -124
  244. data/lib/generators/hydra/templates/solr_conf/conf/solrconfig.xml +0 -394
  245. data/lib/generators/hydra/templates/solr_conf/solr.xml +0 -35
  246. data/lib/hydra-head.rb +0 -29
  247. data/lib/hydra-head/controller.rb +0 -29
  248. data/lib/hydra-head/engine.rb +0 -29
  249. data/lib/hydra-head/routes.rb +0 -90
  250. data/lib/hydra-head/version.rb +0 -4
  251. data/lib/hydra.rb +0 -52
  252. data/lib/hydra/assets.rb +0 -7
  253. data/lib/hydra/assets_controller_helper.rb +0 -122
  254. data/lib/hydra/catalog.rb +0 -11
  255. data/lib/hydra/controller.rb +0 -26
  256. data/lib/hydra/controller/assets_controller_behavior.rb +0 -143
  257. data/lib/hydra/controller/catalog_controller_behavior.rb +0 -56
  258. data/lib/hydra/controller/controller_behavior.rb +0 -59
  259. data/lib/hydra/controller/file_assets_behavior.rb +0 -144
  260. data/lib/hydra/controller/repository_controller_behavior.rb +0 -119
  261. data/lib/hydra/controller/upload_behavior.rb +0 -139
  262. data/lib/hydra/file_assets.rb +0 -11
  263. data/lib/hydra/file_assets_helper.rb +0 -12
  264. data/lib/hydra/generic_content.rb +0 -130
  265. data/lib/hydra/generic_image.rb +0 -112
  266. data/lib/hydra/generic_user_attributes.rb +0 -41
  267. data/lib/hydra/global_configurable.rb +0 -46
  268. data/lib/hydra/model_methods.rb +0 -104
  269. data/lib/hydra/model_mixins.rb +0 -8
  270. data/lib/hydra/model_mixins/common_metadata.rb +0 -25
  271. data/lib/hydra/model_mixins/solr_document_extension.rb +0 -24
  272. data/lib/hydra/models/file_asset.rb +0 -78
  273. data/lib/hydra/repository_controller.rb +0 -28
  274. data/lib/hydra/rights_metadata.rb +0 -194
  275. data/lib/hydra/solr.rb +0 -9
  276. data/lib/hydra/submission_workflow.rb +0 -138
  277. data/lib/hydra/superuser_attributes.rb +0 -19
  278. data/lib/hydra/ui.rb +0 -6
  279. data/lib/hydra/ui/controller.rb +0 -46
  280. data/lib/hydra/workflow.rb +0 -5
  281. data/lib/hydra/workflow/controller.rb +0 -3
  282. data/lib/mediashelf/active_fedora_helper.rb +0 -73
  283. data/lib/prev_next_links.rb +0 -33
  284. data/lib/railties/active-fedora.rake +0 -1
  285. data/lib/railties/hydra-fixtures.rake +0 -50
  286. data/lib/railties/hydra_jetty.rake +0 -53
  287. data/lib/user_attributes_loader.rb +0 -26
  288. data/solr/conf/schema.xml +0 -116
  289. data/solr/conf/solrconfig.xml +0 -311
  290. data/solr/solr.xml +0 -35
  291. data/solr_conf/conf/schema.xml +0 -124
  292. data/solr_conf/conf/solrconfig.xml +0 -394
  293. data/solr_conf/solr.xml +0 -35
  294. data/tasks/active-fedora.rake +0 -1
  295. data/tasks/hydra-head-fixtures.rake +0 -58
  296. data/tasks/hydra-head.rake +0 -209
  297. data/tasks/hydra_jetty.rake +0 -53
  298. data/tasks/hyhead_rspec.rake +0 -57
  299. data/tasks/replicator.rake +0 -27
  300. data/tasks/solrizer-fedora.rake +0 -53
  301. data/tasks/solrizer.rake +0 -13
  302. data/test_support/etc/Gemfile +0 -46
  303. data/test_support/etc/common_metadata_asset.rb +0 -18
  304. data/test_support/features/absent_model_edit.feature +0 -27
  305. data/test_support/features/absent_model_search_result.feature +0 -18
  306. data/test_support/features/absent_model_show.feature +0 -27
  307. data/test_support/features/button_add_assets.feature +0 -22
  308. data/test_support/features/button_add_generic_content.feature +0 -11
  309. data/test_support/features/button_add_image.feature +0 -11
  310. data/test_support/features/button_add_mods_asset.feature +0 -11
  311. data/test_support/features/button_delete_asset.feature +0 -13
  312. data/test_support/features/contributor_add.feature +0 -44
  313. data/test_support/features/default_partials_edit.feature +0 -27
  314. data/test_support/features/default_partials_search_result.feature +0 -22
  315. data/test_support/features/default_partials_show.feature +0 -24
  316. data/test_support/features/file_upload.feature +0 -80
  317. data/test_support/features/generic_content_create.feature +0 -7
  318. data/test_support/features/generic_content_edit.feature +0 -21
  319. data/test_support/features/generic_content_search_result.feature +0 -22
  320. data/test_support/features/generic_content_show.feature +0 -20
  321. data/test_support/features/generic_image_create.feature +0 -7
  322. data/test_support/features/generic_image_edit.feature +0 -21
  323. data/test_support/features/generic_image_search_result.feature +0 -22
  324. data/test_support/features/generic_image_show.feature +0 -20
  325. data/test_support/features/home_page.feature +0 -9
  326. data/test_support/features/html_validity.feature +0 -43
  327. data/test_support/features/mods_asset_contributors_edit.feature +0 -88
  328. data/test_support/features/mods_asset_create.feature +0 -17
  329. data/test_support/features/mods_asset_edit.feature +0 -65
  330. data/test_support/features/mods_asset_edit_without_permission.feature +0 -15
  331. data/test_support/features/mods_asset_search_result.feature +0 -24
  332. data/test_support/features/mods_asset_show.feature +0 -90
  333. data/test_support/features/nonexistent_object_show.feature +0 -9
  334. data/test_support/features/permissions_add.feature +0 -16
  335. data/test_support/features/permissions_edit.feature +0 -65
  336. data/test_support/features/step_definitions/catalog_index_steps.rb +0 -14
  337. data/test_support/features/step_definitions/create_asset_steps.rb +0 -3
  338. data/test_support/features/step_definitions/edit_metadata_steps.rb +0 -72
  339. data/test_support/features/step_definitions/file_list_steps.rb +0 -36
  340. data/test_support/features/step_definitions/html_validity_steps.rb +0 -64
  341. data/test_support/features/step_definitions/hydra_metadata_steps.rb +0 -3
  342. data/test_support/features/step_definitions/hydra_steps.rb +0 -8
  343. data/test_support/features/step_definitions/inline_editable_edit_steps.rb +0 -77
  344. data/test_support/features/step_definitions/search_steps.rb +0 -88
  345. data/test_support/features/step_definitions/searching_steps.rb +0 -22
  346. data/test_support/features/step_definitions/show_document_steps.rb +0 -89
  347. data/test_support/features/step_definitions/user_steps.rb +0 -42
  348. data/test_support/features/step_definitions/web_steps.rb +0 -223
  349. data/test_support/features/support/env.rb +0 -57
  350. data/test_support/features/support/paths.rb +0 -85
  351. data/test_support/features/switch_users.feature +0 -14
  352. data/test_support/features/view_catalog_index.feature +0 -18
  353. data/test_support/fixtures/empty_file.txt +0 -0
  354. data/test_support/fixtures/hydra_test_default_partials.foxml.xml +0 -80
  355. data/test_support/fixtures/hydra_test_generic_content.foxml.xml +0 -138
  356. data/test_support/fixtures/hydra_test_generic_image.foxml.xml +0 -395
  357. data/test_support/fixtures/hydra_test_no_model.foxml.xml +0 -79
  358. data/test_support/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +0 -1212
  359. data/test_support/fixtures/hydrangea_fixture_file_asset1.foxml.xml +0 -4946
  360. data/test_support/fixtures/hydrangea_fixture_mods_article1.foxml.xml +0 -234
  361. data/test_support/fixtures/hydrangea_fixture_mods_article2.foxml.xml +0 -177
  362. data/test_support/fixtures/hydrangea_fixture_mods_article3.foxml.xml +0 -170
  363. data/test_support/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +0 -187
  364. data/test_support/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +0 -676
  365. data/test_support/fixtures/hydrus_admin_class1.foxml.xml +0 -176
  366. data/test_support/fixtures/image.jp2 +0 -0
  367. data/test_support/fixtures/libra-oa_1.foxml.xml +0 -2324
  368. data/test_support/fixtures/libra-oa_2.foxml.xml +0 -2422
  369. data/test_support/fixtures/libra-oa_7.foxml.xml +0 -1735
  370. data/test_support/fixtures/small_file.txt +0 -1
  371. data/test_support/spec/controllers/catalog_controller_spec.rb +0 -138
  372. data/test_support/spec/controllers/catalog_controller_viewing_context_spec.rb +0 -67
  373. data/test_support/spec/controllers/catalog_valid_html_spec.rb +0 -123
  374. data/test_support/spec/controllers/contributors_controller_spec.rb +0 -67
  375. data/test_support/spec/controllers/file_assets_controller_spec.rb +0 -194
  376. data/test_support/spec/controllers/hydra-assets_controller_spec.rb +0 -151
  377. data/test_support/spec/controllers/hydra_controller_spec.rb +0 -43
  378. data/test_support/spec/controllers/hydra_ui_controller_spec.rb +0 -21
  379. data/test_support/spec/controllers/permissions_controller_spec.rb +0 -39
  380. data/test_support/spec/controllers/user_sessions_controller_spec.rb +0 -35
  381. data/test_support/spec/factories.rb +0 -11
  382. data/test_support/spec/helpers/access_controls_enforcement_spec.rb +0 -119
  383. data/test_support/spec/helpers/access_controls_evaluation_spec.rb +0 -26
  384. data/test_support/spec/helpers/assets_controller_helper_spec.rb +0 -63
  385. data/test_support/spec/helpers/blacklight_helper_spec.rb +0 -60
  386. data/test_support/spec/helpers/file_assets_helper_spec.rb +0 -116
  387. data/test_support/spec/helpers/generic_content_objects_helper_spec.rb +0 -17
  388. data/test_support/spec/helpers/hydra-repository_controller_spec.rb +0 -54
  389. data/test_support/spec/helpers/hydra_assets_helper_spec.rb +0 -143
  390. data/test_support/spec/helpers/hydra_fedora_metadata_helper_spec.rb +0 -255
  391. data/test_support/spec/helpers/hydra_helper_spec.rb +0 -105
  392. data/test_support/spec/helpers/hydra_model_methods_spec.rb +0 -88
  393. data/test_support/spec/helpers/hydra_uploader_helper_spec.rb +0 -26
  394. data/test_support/spec/helpers/javascript_includes_helper_spec.rb +0 -51
  395. data/test_support/spec/integration/file_asset_spec.rb +0 -68
  396. data/test_support/spec/lib/catalog_spec.rb +0 -23
  397. data/test_support/spec/lib/global_configurable_spec.rb +0 -98
  398. data/test_support/spec/lib/hydra_submission_workflow_spec.rb +0 -141
  399. data/test_support/spec/lib/model_methods_spec.rb +0 -29
  400. data/test_support/spec/models/file_asset_spec.rb +0 -25
  401. data/test_support/spec/models/generic_content_spec.rb +0 -39
  402. data/test_support/spec/models/generic_image_spec.rb +0 -75
  403. data/test_support/spec/models/mods_asset_spec.rb +0 -20
  404. data/test_support/spec/models/solr_document_spec.rb +0 -17
  405. data/test_support/spec/models/user_spec.rb +0 -94
  406. data/test_support/spec/rcov.opts +0 -3
  407. data/test_support/spec/spec.opts +0 -4
  408. data/test_support/spec/spec_helper.rb +0 -63
  409. data/test_support/spec/support/matchers/helper_matcher.rb +0 -14
  410. data/test_support/spec/support/matchers/solr_matchers.rb +0 -60
  411. data/test_support/spec/unit/hydra-head-engine_spec.rb +0 -8
  412. data/test_support/spec/unit/hydra-head_spec.rb +0 -8
@@ -1 +0,0 @@
1
- small
@@ -1,138 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require 'mocha'
3
-
4
-
5
- # See cucumber tests (ie. /features/edit_document.feature) for more tests, including ones that test the edit method & view
6
- # You can run the cucumber tests with
7
- #
8
- # cucumber --tags @edit
9
- # or
10
- # rake cucumber
11
-
12
- describe CatalogController do
13
- before :all do
14
- @behavior = Hydra::Controller::CatalogControllerBehavior.deprecation_behavior
15
- Hydra::Controller::CatalogControllerBehavior.deprecation_behavior = :silence
16
- end
17
-
18
- after :all do
19
- Hydra::Controller::CatalogControllerBehavior.deprecation_behavior = @behavior
20
- end
21
-
22
- before do
23
- #controller.stubs(:protect_from_forgery).returns("meh")
24
- session[:user]='bob'
25
- end
26
-
27
- it "should use CatalogController" do
28
- controller.should be_an_instance_of(CatalogController)
29
- end
30
-
31
-
32
- describe "Paths Generated by Custom Routes:" do
33
- # paths generated by custom routes
34
- it "should map {:controller=>'catalog', :action=>'index'} to GET /catalog" do
35
- { :get => "/catalog" }.should route_to(:controller => 'catalog', :action => 'index')
36
- end
37
- it "should map {:controller=>'catalog', :action=>'show', :id=>'test:3'} to GET /catalog/test:3" do
38
- { :get => "/catalog/test:3" }.should route_to(:controller => 'catalog', :action => 'show', :id=>'test:3')
39
- end
40
- it "should map {:controller=>'catalog', :action=>'edit', :id=>'test:3'} to GET /catalog/test:3" do
41
- { :get => "/catalog/test:3/edit" }.should route_to(:controller => 'catalog', :action => 'edit', :id=>'test:3')
42
- end
43
-
44
- it "should map catalog_path" do
45
- # catalog_path.should == '/catalog'
46
- catalog_path("test:3").should == '/catalog/test:3'
47
- end
48
- end
49
-
50
- it "should not choke on objects with periods in ids (ie Fedora system objects)" do
51
- pending "Need to override blacklight routes"
52
-
53
- ## We could do something like this to remove the catalog/show route and replace it with a route that allows dots (e.g. resources :catalog, :id=> /.+/)
54
- # def add_route
55
- # new_route = ActionController::Routing::Routes.builder.build(name, route_options)
56
- # ActionController::Routing::Routes.routes.insert(0, new_route)
57
- # end
58
-
59
- # def remove_route
60
- # ActionController::Routing::Routes.routes.reject! { |r| r.instance_variable_get(:@requirements)[:slug_id] == id }
61
- # end
62
-
63
- catalog_path("fedora-system:FedoraObject-3.0").should == '/catalog/fedora-system:FedoraObject-3.0'
64
- { :get => "/catalog/fedora-system:FedoraObject-3.0" }.should route_to(:controller => 'catalog', :action => 'show', :id=>'fedora-system:FedoraObject-3.0')
65
- end
66
-
67
- describe "index" do
68
-
69
- describe "access controls" do
70
- before(:all) do
71
- @public_only_results = Blacklight.solr.find Hash[:fq=>"access_t:public"]
72
- # @public_only_results = Blacklight.solr.find Hash[:phrases=>{:access_t=>"public"}]
73
- # @private_only_results = Blacklight.solr.find Hash[:phrases=>{:access_t=>"private"}]
74
- @private_only_results = Blacklight.solr.find Hash[:fq=>"access_t:private"]
75
- end
76
-
77
- it "should only return public documents if role does not have permissions" do
78
- controller.stubs(:current_user).returns(nil)
79
- get :index
80
- assigns(:document_list).count.should == @public_only_results.docs.count
81
- end
82
- it "should return all documents if role does have permissions" do
83
- mock_user = FactoryGirl.create(:user, :email=>"BigWig@example.com")
84
- # session[:superuser_mode] = true
85
- mock_user.stubs(:is_being_superuser?).returns(true)
86
- #sign_in mock_user
87
- controller.stubs(:current_user).returns(mock_user)
88
- get :index
89
- ### This fails when there are more than 10 public documents in the solr index
90
- ### TODO: instead, expect a certain query(especially the :fq component) to solr
91
- assigns(:document_list).count.should > @public_only_results.docs.count
92
- end
93
- end
94
- end
95
-
96
- describe "edit" do
97
-
98
- it "should trigger show action" do
99
- controller.expects(:show)
100
- controller.stubs(:enforce_access_controls)
101
- controller.stubs(:load_fedora_document)
102
- get :edit, :id=>'hydrangea:fixture_mods_article1'
103
- end
104
- it "should render show template (which then delegates to edit partials)" do
105
- controller.stubs(:enforce_access_controls)
106
- controller.stubs(:load_fedora_document)
107
- get :edit, :id=>'hydrangea:fixture_mods_article1'
108
- response.should render_template("show")
109
- end
110
- end
111
-
112
- describe "filters" do
113
- describe "index" do
114
- it "should trigger enforce_index_permissions" do
115
- controller.expects(:add_access_controls_to_solr_params)
116
- controller.expects(:enforce_index_permissions)
117
- get :index
118
- end
119
- end
120
- describe "show" do
121
- it "should trigger enforce_show_permissions and load_fedora_document" do
122
- controller.stubs(:current_user).returns(nil)
123
- controller.expects(:load_fedora_document)
124
- controller.expects(:enforce_show_permissions)
125
- get :show, :id=>'test:3'
126
- end
127
- end
128
- describe "edit" do
129
- it "should trigger enforce_edit_permissions and load_fedora_document" do
130
- controller.stubs(:current_user).returns(nil)
131
- controller.expects(:load_fedora_document)
132
- controller.expects(:enforce_edit_permissions)
133
- get :edit, :id=>'test:3'
134
- end
135
- end
136
- end
137
-
138
- end
@@ -1,67 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
-
4
- # See cucumber tests (ie. /features/edit_document.feature) for more tests, including ones that test the edit method & view
5
- # You can run the cucumber tests with
6
- #
7
- # cucumber --tags @edit
8
- # or
9
- # rake cucumber
10
-
11
- describe CatalogController do
12
- before :all do
13
- @behavior = Hydra::Controller::CatalogControllerBehavior.deprecation_behavior
14
- Hydra::Controller::CatalogControllerBehavior.deprecation_behavior = :silence
15
- end
16
-
17
- after :all do
18
- Hydra::Controller::CatalogControllerBehavior.deprecation_behavior = @behavior
19
- end
20
-
21
-
22
- before do
23
- controller.stubs(:load_fedora_document)
24
- end
25
-
26
- describe "show" do
27
- it "should redirect to edit view if session is in edit context and user has edit permission" do
28
- controller.stubs(:can?).returns(true)
29
- controller.session[:viewing_context] = "edit"
30
- get(:show, {:id=>"hydrangea:fixture_mods_article1"})
31
- response.should redirect_to(:action => 'edit')
32
- end
33
- it "should allow you to reset the session context to browse using :viewing_context param" do
34
- controller.stubs(:can?).returns(true)
35
- controller.session[:viewing_context] = "edit"
36
- get(:show, :id=>"hydrangea:fixture_mods_article1", :viewing_context=>"browse")
37
- session[:viewing_context].should == "browse"
38
- response.should_not redirect_to(:action => 'edit')
39
- end
40
-
41
- it "should quietly switch session state to browse if user does not have edit permissions" do
42
- controller.stubs(:can?).with(:edit, anything()).returns(false)
43
- controller.stubs(:can?).with(:read, anything()).returns(true)
44
- controller.session[:viewing_context] = "edit"
45
- get(:show, {:id=>"hydrangea:fixture_mods_article1"})
46
- session[:viewing_context].should == "browse"
47
- response.should_not redirect_to(:action => 'edit')
48
- end
49
- end
50
-
51
- describe "edit" do
52
- it "should enforce edit permissions, redirecting to show action and resetting session context if user does not have edit permissions" do
53
- mock_user = FactoryGirl.build(:user, :email => "patron1@example.com")
54
- sign_in mock_user
55
-
56
- get :edit, :id=>"hydrangea:fixture_mods_article1"
57
- response.should redirect_to(:action => 'show')
58
- flash[:alert].should == "You do not have sufficient privileges to edit this document. You have been redirected to the read-only view."
59
- end
60
- it "should render normally if user has edit permissions" do
61
- controller.expects(:can?).with(:edit, anything()).returns(true)
62
- get :edit, :id=>"hydrangea:fixture_mods_article1"
63
- response.should_not redirect_to(:action => 'show')
64
- end
65
- end
66
-
67
- end
@@ -1,123 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require 'mocha'
3
-
4
- # This uses nokogiri to check formedness. It's slightly less strict than the markup_validit
5
- # currently not being used.
6
- def well_formed(html)
7
- begin
8
- Nokogiri::XML(html.gsub("&", "&" )) { |config| config.strict } #Literal & in text are not allowed, but we don't care.
9
- return "ok"
10
- rescue Nokogiri::XML::SyntaxError => e
11
- # Write the offensive HTML to a file in tmp/html_validity_failures with a filename based on Time.now.iso8601
12
- html_failures_dir = File.expand_path(File.dirname(__FILE__) + '/../../tmp/html_validity_failures')
13
- FileUtils.mkdir_p(html_failures_dir)
14
- filename = Time.now.iso8601(3).gsub(":","")+".html"
15
- file_path = File.join(html_failures_dir, filename)
16
- file = File.open(file_path, "w")
17
- file.write(html)
18
- return "#{e.inspect} -- Line: #{e.line} -- Level: #{e.level} -- Code: #{e.code}. HTML Saved to RAILS_ROOT/tmp/html_validity_failures/#{filename}"
19
- end
20
- end
21
-
22
-
23
-
24
- # This checks document for validity (if required) and well formedness
25
- # Pass in a html string. IF you want to check for XHTML validity, do rake spec HTML_VALIDITY=true. Otherwise only document form is checked
26
- # by nokogiri.
27
- def document_check(html, html_validity=ENV["HTML_VALIDITY"])
28
- if html_validity == "true" || html_validity == true
29
- html.should be_xhtml_transitional
30
- end
31
- well_formed(html).should == "ok"
32
- end
33
-
34
-
35
- describe CatalogController do
36
- before :all do
37
- @behavior = Hydra::Controller::ControllerBehavior.deprecation_behavior
38
- Hydra::Controller::ControllerBehavior.deprecation_behavior = :silence
39
- end
40
-
41
- after :all do
42
- Hydra::Controller::ControllerBehavior.deprecation_behavior = @behavior
43
- end
44
- describe "Home Page" do
45
-
46
- it "Should have Valid HTML when not logged in" do
47
- controller.stubs(:current_user).returns(nil)
48
- get("index", "controller"=>"catalog")
49
- document_check(response.body)
50
- end
51
-
52
- it "Should have Valid HTML when I'm logged in" do
53
- mock_user = FactoryGirl.build(:user, :email=>"archivist1@example.com")
54
- mock_user.stubs(:can_be_superuser?).returns(true)
55
- mock_user.stubs(:is_being_superuser?).returns(true)
56
-
57
- sign_in mock_user
58
- get("index", "controller"=>"catalog")
59
- document_check(response.body)
60
- end
61
- end
62
-
63
- describe "Document Pages" do
64
-
65
- before(:each) do
66
- mock_user = FactoryGirl.build(:user, :email=>"archivist1@example.com")
67
- mock_user.stubs(:can_be_superuser?).returns(true)
68
- mock_user.stubs(:is_being_superuser?).returns(true)
69
- sign_in mock_user
70
- end
71
-
72
- #Article Data Type
73
- it "Should have valid html when in Article Edit Show" do
74
- controller.session[:viewing_context] = "edit"
75
- get(:show, {:id=>"hydrangea:fixture_mods_article1"}, :action=>"edit")
76
- document_check(response.body)
77
- end
78
-
79
- it "Should have valid html when in Article Browse Show" do
80
-
81
- controller.session[:viewing_context] = "browse"
82
- get(:show, {:id=>"hydrangea:fixture_mods_article1"}, :action=>"browse")
83
- document_check(response.body)
84
- end
85
-
86
- #Data Set Data Type
87
- it "Should have valid html when in Dataset Edit Show" do
88
- controller.session[:viewing_context] = "edit"
89
- get(:show, {:id=>"hydrangea:fixture_mods_dataset1"}, :action=>"edit")
90
- document_check(response.body)
91
- end
92
-
93
- it "Should have valid html when in Dataset Browse Show" do
94
- controller.session[:viewing_context] = "browse"
95
- get(:show, {:id=>"hydrangea:fixture_mods_dataset1"}, :action=>"browse")
96
- document_check(response.body)
97
- end
98
-
99
- #APO datatype hydrus:admin_class1
100
- it "Should have valid html when in Dataset Edit Show" do
101
- controller.session[:viewing_context] = "edit"
102
- get(:show, {:id=>"hydrus:admin_class1"}, :action=>"edit")
103
- document_check(response.body)
104
- end
105
-
106
- it "Should have valid html when in Dataset Browse Show" do
107
- controller.session[:viewing_context] = "browse"
108
- get(:show, {:id=>"hydrus:admin_class1"}, :action=>"browse")
109
- File.open('/tmp/out.xml', 'w') { |f| f << response.body }
110
- document_check(response.body)
111
-
112
- end
113
-
114
- # The delete view should be the same for all data types
115
- it "Should have valid html when in Dataset Delete" do
116
- get(:show, {:id=>"hydrangea:fixture_mods_dataset1"}, :action=>"delete")
117
- document_check(response.body)
118
- end
119
-
120
-
121
- end #Document pages
122
-
123
- end
@@ -1,67 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
-
4
- # See cucumber tests (ie. /features/edit_document.feature) for more tests, including ones that test the edit method & view
5
- # You can run the cucumber tests with
6
- #
7
- # cucumber --tags @edit
8
- # or
9
- # rake cucumber
10
-
11
- describe Hydra::ContributorsController do
12
- before :all do
13
- @behavior = Hydra::ContributorsController.deprecation_behavior
14
- Hydra::ContributorsController.deprecation_behavior = :silence
15
-
16
- end
17
-
18
- after :all do
19
- Hydra::ContributorsController.deprecation_behavior = @behavior
20
-
21
- end
22
-
23
- describe "create" do
24
- it "should support adding new person / contributor / organization nodes" do
25
- mock_document = mock("document")
26
- # stub out access controlls enforcement
27
- controller.expects(:enforce_access_controls).at_least_once.returns(true)
28
- ["person","conference","organization"].each do |type|
29
- mock_document.expects(:insert_contributor).with(type).returns(["foo node",989])
30
- mock_document.expects(:save)
31
- ModsAsset.expects(:find).with("_PID_").returns(mock_document)
32
- post :create, :asset_id=>"_PID_", :controller => "contributors", :content_type => "mods_asset", :contributor_type=>type
33
- response.should redirect_to edit_catalog_path('_PID_', :anchor=>"#{type}_989")
34
- end
35
- end
36
- it "should return inline html if format is inline" do
37
- mock_document = mock("document")
38
- # stub out access controlls enforcement
39
- controller.expects(:enforce_access_controls).at_least_once.returns(true)
40
- ["person","conference","organization"].each do |type|
41
- mock_document.expects(:insert_contributor).with(type).returns(["foo node","foo index"])
42
- mock_document.expects(:save)
43
- ModsAsset.expects(:find).with("_PID_").returns(mock_document)
44
- post :create, :asset_id=>"_PID_", :controller => "contributors", :content_type => "mods_asset", :contributor_type=>type, :format=>"inline"
45
- response.should render_template "contributors/_edit_#{type}"
46
- end
47
- end
48
- end
49
-
50
- describe "destroy" do
51
- it "should delete the contributor corresponding to contributor_type and index" do
52
- mock_dataset = mock("Dataset")
53
- mock_dataset.expects(:remove_contributor).with("conference", "3")
54
- mock_dataset.expects(:save)
55
- ModsAsset.expects(:find).with("_PID_").returns(mock_dataset)
56
- # stub out authorize!
57
- controller.expects(:authorize!).with(:edit, mock_dataset)
58
- delete :destroy, :asset_id=>"_PID_", :content_type => "mods_asset", :contributor_type=>"conference", :index=>"3"
59
- end
60
- it "should now allow non-authed users to destroy contributors" do
61
- mock_dataset = mock("Dataset")
62
- ModsAsset.expects(:find).with("_PID_").returns(mock_dataset)
63
- lambda{delete :destroy, :asset_id=>"_PID_", :content_type => "mods_asset", :contributor_type=>"conference", :index=>"3"}.should raise_error(CanCan::AccessDenied)
64
- end
65
- end
66
-
67
- end
@@ -1,194 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe Hydra::FileAssetsController do
4
- include Devise::TestHelpers
5
- before do
6
- session[:user]='bob'
7
- end
8
-
9
- it "should be restful" do
10
- { :get => "/hydra/file_assets" }.should route_to(:controller=>'hydra/file_assets', :action=>'index')
11
- { :get => "/hydra/file_assets/3" }.should route_to(:controller=>'hydra/file_assets', :action=>'show', :id=>"3")
12
- { :delete=> "/hydra/file_assets/3" }.should route_to(:controller=>'hydra/file_assets', :action=>'destroy', :id=>"3")
13
- { :put=>"/hydra/file_assets/3" }.should route_to(:controller=>'hydra/file_assets', :action=>'update', :id=>"3")
14
- { :get => "/hydra/file_assets/3/edit" }.should route_to(:controller=>'hydra/file_assets', :action=>'edit', :id=>"3")
15
- { :get =>"/hydra/file_assets/new" }.should route_to(:controller=>'hydra/file_assets', :action=>'new')
16
- { :post => "/hydra/file_assets" }.should route_to(:controller=>'hydra/file_assets', :action=>'create')
17
-
18
- end
19
-
20
- describe "index" do
21
-
22
- it "should find all file assets in the repo if no container_id is provided" do
23
- ActiveFedora::SolrService.expects(:query).with('active_fedora_model_s:FileAsset', {}).returns("solr result")
24
- controller.stubs(:load_permissions_from_solr)
25
- ActiveFedora::Base.expects(:new).never
26
- xhr :get, :index
27
- assigns[:solr_result].should == "solr result"
28
- end
29
- it "should find all file assets belonging to a given container object if asset_id is provided" do
30
- pid = 'hydrangea:fixture_mods_article3'
31
- xhr :get, :index, :asset_id=>pid
32
- assigns[:response][:response][:docs].first["id"].should == "hydrangea:fixture_file_asset1"
33
- assigns[:document_list].first.id.should == "hydrangea:fixture_file_asset1"
34
-
35
- assigns[:container_response][:response][:docs].first["id"].should == "hydrangea:fixture_mods_article3"
36
- assigns[:document].id.should == "hydrangea:fixture_mods_article3"
37
- assigns[:solr_result].first["id"].should == "hydrangea:fixture_file_asset1"
38
- assigns[:container].should == ModsAsset.find('hydrangea:fixture_mods_article3')
39
- end
40
-
41
- end
42
-
43
- describe "new" do
44
- it "should set :container_id to value of :container_id if available" do
45
- xhr :get, :new, :asset_id=>"_PID_"
46
- @controller.params[:asset_id].should == "_PID_"
47
- end
48
- end
49
-
50
- describe "show" do
51
- it "should redirect back if current_user does not have read or edit permissions" do
52
- mock_user = mock("User")
53
- mock_user.stubs(:email).returns("fake_user@example.com")
54
- mock_user.stubs(:is_being_superuser?).returns(false)
55
- mock_user.stubs(:persisted?).returns(true)
56
- mock_user.stubs(:new_record?).returns(false)
57
- controller.stubs(:current_user).returns(mock_user)
58
- request.env["HTTP_REFERER"] = "http://example.com/?q=search"
59
- get(:show, :id=>"hydrangea:fixture_file_asset1")
60
- response.should redirect_to(root_url)
61
- end
62
- it "should redirect to the login page if the user is not logged in" do
63
- mock_user = mock("User")
64
- mock_user.stubs(:email).returns("fake_user@example.com")
65
- mock_user.stubs(:is_being_superuser?).returns(false)
66
- mock_user.stubs(:persisted?).returns(false)
67
- mock_user.stubs(:new_record?).returns(true)
68
- controller.stubs(:current_user).returns(mock_user)
69
- request.env["HTTP_REFERER"] = "http://example.com/?q=search"
70
- get(:show, :id=>"hydrangea:fixture_file_asset1")
71
- response.should redirect_to("http://test.host/users/sign_in")
72
- session['user_return_to'].should =~ /fixture_file_asset1/
73
- end
74
- it "should redirect to index view if the file does not exist" do
75
- get(:show, :id=>"example:invalid_object")
76
- response.should redirect_to(:action => 'index')
77
- end
78
- end
79
-
80
- describe "create" do
81
- it "should create and save a file asset from the given params" do
82
- # stub out authorize! call
83
- controller.expects(:authorize!).with(:edit, "example:invalid_object").returns(true)
84
- mock_fa = mock("FileAsset")
85
- mock_file = mock("File")
86
- mock_fa.stubs(:pid).returns("foo:pid")
87
- controller.expects(:create_and_save_file_assets_from_params).returns([mock_fa])
88
- xhr :post, :create, :Filedata=>[mock_file], :Filename=>"Foo File", :id => "example:invalid_object"
89
- end
90
- it "if container_id is provided, should associate the created file asset wtih the container" do
91
- # stub out authorize! call
92
- controller.expects(:authorize!).with(:edit, "_PID_").returns(true)
93
- stub_fa = stub("FileAsset", :save)
94
- stub_fa.stubs(:pid).returns("foo:pid")
95
- stub_fa.stubs(:label).returns("Foo File")
96
- mock_file = mock("File")
97
- controller.expects(:create_and_save_file_assets_from_params).returns([stub_fa])
98
- controller.expects(:associate_file_asset_with_container)
99
- xhr :post, :create, :Filedata=>[mock_file], :Filename=>"Foo File", :container_id=>"_PID_"
100
- end
101
- it "should redirect back to edit view if no Filedata is provided but container_id is provided" do
102
- # stub out authorize! call
103
- controller.expects(:authorize!).with(:edit, "_PID_").returns(true)
104
- controller.expects(:model_config).at_least_once.returns(controller.workflow_config[:mods_assets])
105
- xhr :post, :create, :container_id=>"_PID_", :wf_step=>"files"
106
- response.should redirect_to edit_catalog_path("_PID_", :wf_step=>"permissions")
107
- request.flash[:notice].should == "You must specify a file to upload."
108
- end
109
- it "should display a message that you need to select a file to upload if no Filedata is provided" do
110
- # stub out authorize! call
111
- controller.expects(:authorize!).returns(true)
112
- xhr :post, :create
113
- request.flash[:notice].include?("You must specify a file to upload.").should be_true
114
- end
115
- it "should throw an error if you don't have the ability to edit the parent object" do
116
- lambda{xhr :post, :create, :id => "hydrangea:fixture_mods_dataset1"}.should raise_error(CanCan::AccessDenied)
117
- end
118
-
119
- end
120
-
121
- describe "destroy" do
122
- it "should delete the asset identified by pid" do
123
- # stub out authorize! call
124
- controller.expects(:authorize!).returns(true)
125
- mock_obj = mock("asset", :delete)
126
- ActiveFedora::Base.expects(:find).with("__PID__", :cast=>true).returns(mock_obj)
127
- delete(:destroy, :id => "__PID__")
128
- end
129
- it "should remove container relationship and perform proper garbage collection" do
130
- pending "relies on ActiveFedora implementing Base.file_objects_remove"
131
- mock_container = mock("asset")
132
- mock_container.expects(:file_objects_remove).with("_file_asset_pid_")
133
- FileAsset.expects(:garbage_collect).with("_file_asset_pid_")
134
- ActiveFedora::Base.expects(:find).with("_container_pid_", :cast=>true).returns(mock_container)
135
- delete(:destroy, :id => "_file_asset_pid_", :asset_id=>"_container_pid_")
136
- end
137
- end
138
-
139
- describe "integration tests - " do
140
- before(:all) do
141
- class TestObj < ActiveFedora::Base
142
- include ActiveFedora::FileManagement
143
- end
144
-
145
- ActiveFedora::SolrService.register(ActiveFedora.solr_config[:url])
146
- @test_container = TestObj.new
147
- @test_container.add_relationship(:is_member_of, "info:fedora/foo:1")
148
- @test_container.add_relationship(:has_collection_member, "info:fedora/foo:2")
149
- @test_container.save
150
-
151
- @test_fa = FileAsset.new
152
- @test_fa.add_relationship(:is_part_of, @test_container)
153
- @test_fa.save
154
- end
155
-
156
- after(:all) do
157
- @test_container.delete
158
- @test_fa.delete
159
- Object.send(:remove_const, :TestObj)
160
- end
161
-
162
- describe "index" do
163
- it "should retrieve the container object and its file assets" do
164
- #xhr :get, :index, :container_id=>@test_container.pid
165
- get :index, {:asset_id=>@test_container.pid}
166
- @controller.params[:asset_id].should_not be_nil
167
- assigns(:solr_result).should_not be_nil
168
- #puts assigns(:solr_result).inspect
169
- assigns(:container).file_objects(:response_format=>:id_array).should include(@test_fa.pid)
170
- assigns(:container).file_objects(:response_format=>:id_array).should include("foo:2")
171
- end
172
- end
173
-
174
- describe "create" do
175
- before :each do
176
- mock_user = mock("User")
177
- mock_user.stubs(:user_key).returns('user@example.com')
178
- mock_warden = mock("Warden")
179
- mock_warden.stubs(:authenticate).returns(mock_user)
180
- request.env['warden'] = mock_warden
181
- end
182
-
183
- it "should set is_part_of relationship on the new File Asset pointing back at the container" do
184
- # stub out authorize! call
185
- controller.expects(:authorize!).returns(true)
186
- test_file = fixture_file_upload('/small_file.txt', 'text/plain')
187
- filename = "My File Name"
188
- post :create, {:Filedata=>[test_file], :Filename=>filename, :container_id=>@test_container.pid}
189
- assigns(:file_asset).ids_for_outbound(:is_part_of).should == [@test_container.pid]
190
- retrieved_fa = FileAsset.find(@test_fa.pid).ids_for_outbound(:is_part_of).should == [@test_container.pid]
191
- end
192
- end
193
- end
194
- end