hydra-head 3.0.0pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (366) hide show
  1. data/.gitignore +71 -0
  2. data/.gitmodules +6 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +257 -0
  5. data/README.textile +150 -0
  6. data/README_RAILS3_CHANGES.textile +42 -0
  7. data/Rakefile +5 -0
  8. data/TESTING.textile +85 -0
  9. data/app/controllers/assets_controller.rb +117 -0
  10. data/app/controllers/contributors_controller.rb +54 -0
  11. data/app/controllers/file_assets_controller.rb +152 -0
  12. data/app/controllers/permissions_controller.rb +137 -0
  13. data/app/controllers/user_sessions_controller.rb +14 -0
  14. data/app/helpers/article_metadata_helper.rb +80 -0
  15. data/app/helpers/blacklight_helper.rb +192 -0
  16. data/app/helpers/downloads_helper.rb +19 -0
  17. data/app/helpers/generic_content_objects_helper.rb +16 -0
  18. data/app/helpers/hydra_assets_helper.rb +75 -0
  19. data/app/helpers/hydra_djatoka_helper.rb +23 -0
  20. data/app/helpers/hydra_fedora_metadata_helper.rb +365 -0
  21. data/app/helpers/hydra_helper.rb +155 -0
  22. data/app/helpers/hydra_uploader_helper.rb +18 -0
  23. data/app/helpers/inline_editable_metadata_helper.rb +15 -0
  24. data/app/helpers/javascript_includes_helper.rb +93 -0
  25. data/app/helpers/release_process_helper.rb +32 -0
  26. data/app/models/audio_asset.rb +8 -0
  27. data/app/models/file_asset.rb +111 -0
  28. data/app/models/generic_content.rb +21 -0
  29. data/app/models/generic_image.rb +62 -0
  30. data/app/models/image_asset.rb +8 -0
  31. data/app/models/mods_asset.rb +6 -0
  32. data/app/models/role_mapper.rb +22 -0
  33. data/app/models/superuser.rb +6 -0
  34. data/app/models/video_asset.rb +8 -0
  35. data/app/views/_add_assets_links.html.erb +13 -0
  36. data/app/views/_brown_sidebar.html +15 -0
  37. data/app/views/_user_util_links.html.erb +31 -0
  38. data/app/views/catalog/_citation.html.erb +11 -0
  39. data/app/views/catalog/_constraints_element.html.erb +34 -0
  40. data/app/views/catalog/_delete_partials/_default.html.erb +29 -0
  41. data/app/views/catalog/_document_list.html.erb +11 -0
  42. data/app/views/catalog/_edit_partials/_default.html.erb +64 -0
  43. data/app/views/catalog/_edit_partials/_default_details.html.erb +15 -0
  44. data/app/views/catalog/_email_form.html.erb +9 -0
  45. data/app/views/catalog/_facets.html.erb +37 -0
  46. data/app/views/catalog/_flash_msg.html.erb +17 -0
  47. data/app/views/catalog/_home.html.erb +6 -0
  48. data/app/views/catalog/_home_text.html.erb +10 -0
  49. data/app/views/catalog/_index_partials/_default.html.erb +20 -0
  50. data/app/views/catalog/_index_partials/_default_details.html.erb +11 -0
  51. data/app/views/catalog/_index_partials/_default_group.html.erb +15 -0
  52. data/app/views/catalog/_search_form.html.erb +12 -0
  53. data/app/views/catalog/_show_partials/_default.html.erb +23 -0
  54. data/app/views/catalog/_show_partials/_default_details.html.erb +12 -0
  55. data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
  56. data/app/views/catalog/_sms_form.html.erb +21 -0
  57. data/app/views/catalog/_sort_and_per_page.html.erb +22 -0
  58. data/app/views/catalog/_uva_tabs.html.erb +10 -0
  59. data/app/views/catalog/about.html.erb +0 -0
  60. data/app/views/catalog/show.html.erb +48 -0
  61. data/app/views/contributors/_add_contributor_split_button.html.erb +10 -0
  62. data/app/views/contributors/_edit_conference.html.erb +29 -0
  63. data/app/views/contributors/_edit_organization.html.erb +29 -0
  64. data/app/views/contributors/_edit_person.html.erb +42 -0
  65. data/app/views/contributors/_index.html.erb +12 -0
  66. data/app/views/contributors/_new.html.erb +10 -0
  67. data/app/views/contributors/_show_conference.html.erb +22 -0
  68. data/app/views/contributors/_show_organization.html.erb +29 -0
  69. data/app/views/contributors/_show_person.html.erb +17 -0
  70. data/app/views/contributors/new.html.erb +13 -0
  71. data/app/views/downloads/index.html.erb +1 -0
  72. data/app/views/file_assets/_deletable_result.html.erb +5 -0
  73. data/app/views/file_assets/_index.html.erb +15 -0
  74. data/app/views/file_assets/_new.html.erb +2 -0
  75. data/app/views/file_assets/_result.html.erb +16 -0
  76. data/app/views/file_assets/index.html.erb +5 -0
  77. data/app/views/fluid_infusion/_uploader.html.erb +81 -0
  78. data/app/views/fluid_infusion/_uploader_generic_content_objects.js.erb +38 -0
  79. data/app/views/fluid_infusion/_uploader_js.erb +45 -0
  80. data/app/views/generic_content_objects/_edit_description.html.erb +50 -0
  81. data/app/views/generic_content_objects/_new.html.erb +0 -0
  82. data/app/views/generic_content_objects/_show_description.html.erb +68 -0
  83. data/app/views/generic_content_objects/contributors/_edit_conference.html.erb +29 -0
  84. data/app/views/generic_content_objects/contributors/_edit_organization.html.erb +29 -0
  85. data/app/views/generic_content_objects/contributors/_edit_person.html.erb +37 -0
  86. data/app/views/generic_content_objects/contributors/_new.html.erb +10 -0
  87. data/app/views/generic_content_objects/contributors/_show_conference.html.erb +22 -0
  88. data/app/views/generic_content_objects/contributors/_show_organization.html.erb +22 -0
  89. data/app/views/generic_content_objects/contributors/_show_person.html.erb +38 -0
  90. data/app/views/generic_contents/_edit.html.erb +59 -0
  91. data/app/views/generic_contents/_index.html.erb +23 -0
  92. data/app/views/generic_contents/_show.html.erb +18 -0
  93. data/app/views/generic_contents/_show_content.html.erb +4 -0
  94. data/app/views/generic_images/_edit.html.erb +59 -0
  95. data/app/views/generic_images/_index.html.erb +24 -0
  96. data/app/views/generic_images/_show.html.erb +18 -0
  97. data/app/views/generic_images/_show_all.html.erb +14 -0
  98. data/app/views/generic_images/_show_content.html.erb +7 -0
  99. data/app/views/layouts/application.html.erb +57 -0
  100. data/app/views/layouts/hydra-head.html.erb +12 -0
  101. data/app/views/mods_assets/_edit.html.erb +49 -0
  102. data/app/views/mods_assets/_edit_description.html.erb +82 -0
  103. data/app/views/mods_assets/_edit_journal.html.erb +72 -0
  104. data/app/views/mods_assets/_index.html.erb +1 -0
  105. data/app/views/mods_assets/_index_list.html.erb +37 -0
  106. data/app/views/mods_assets/_index_table.html.erb +7 -0
  107. data/app/views/mods_assets/_progress_box.html.erb +82 -0
  108. data/app/views/mods_assets/_show.html.erb +44 -0
  109. data/app/views/mods_assets/_show_description.html.erb +44 -0
  110. data/app/views/mods_assets/_show_journal.html.erb +42 -0
  111. data/app/views/mods_assets/_show_permissions.html.erb +14 -0
  112. data/app/views/permissions/_edit_person_permissions.html.erb +35 -0
  113. data/app/views/permissions/_index.html.erb +55 -0
  114. data/app/views/permissions/_new.html.erb +18 -0
  115. data/app/views/permissions/index.html.erb +1 -0
  116. data/app/views/permissions/new.html.erb +1 -0
  117. data/app/views/shared/_delete_asset_confirmation.html.erb +17 -0
  118. data/app/views/user_sessions/_login_form.html.erb +10 -0
  119. data/app/views/user_sessions/logged_out.html.erb +1 -0
  120. data/config/routes.rb +12 -0
  121. data/fedora_conf/conf/fedora.fcfg +1021 -0
  122. data/hydra-head.gemspec +70 -0
  123. data/lib/application_controller.rb +25 -0
  124. data/lib/application_helper.rb +2 -0
  125. data/lib/engine.rb +30 -0
  126. data/lib/generators/hydra/head_generator.rb +152 -0
  127. data/lib/generators/hydra/templates/config/fedora.yml +17 -0
  128. data/lib/generators/hydra/templates/config/initializers/blacklight_config.rb +246 -0
  129. data/lib/generators/hydra/templates/config/initializers/fedora_config.rb +23 -0
  130. data/lib/generators/hydra/templates/config/initializers/hydra_config.rb +29 -0
  131. data/lib/generators/hydra/templates/config/role_map_cucumber.yml +10 -0
  132. data/lib/generators/hydra/templates/config/role_map_development.yml +12 -0
  133. data/lib/generators/hydra/templates/config/role_map_production.yml +2 -0
  134. data/lib/generators/hydra/templates/config/role_map_test.yml +15 -0
  135. data/lib/generators/hydra/templates/config/solr.yml +10 -0
  136. data/lib/generators/hydra/templates/config/solr_mappings.yml +22 -0
  137. data/lib/generators/hydra/templates/fedora_conf/conf/fedora.fcfg +1021 -0
  138. data/lib/generators/hydra/templates/migrations/add_user_attributes_table.rb +15 -0
  139. data/lib/generators/hydra/templates/migrations/create_superusers.rb +12 -0
  140. data/lib/generators/hydra/templates/solr_conf/conf/schema.xml +118 -0
  141. data/lib/generators/hydra/templates/solr_conf/conf/solrconfig.xml +332 -0
  142. data/lib/generators/hydra/templates/solr_conf/solr.xml +35 -0
  143. data/lib/hydra-head.rb +29 -0
  144. data/lib/hydra-head/engine.rb +9 -0
  145. data/lib/hydra-head/routes.rb +87 -0
  146. data/lib/hydra-head/version.rb +4 -0
  147. data/lib/hydra.rb +22 -0
  148. data/lib/hydra/access_controls_enforcement.rb +236 -0
  149. data/lib/hydra/access_controls_evaluation.rb +97 -0
  150. data/lib/hydra/assets_controller_helper.rb +144 -0
  151. data/lib/hydra/catalog.rb +64 -0
  152. data/lib/hydra/common_mods_index_methods.rb +42 -0
  153. data/lib/hydra/controller.rb +7 -0
  154. data/lib/hydra/file_assets_helper.rb +144 -0
  155. data/lib/hydra/fixtures.rb +43 -0
  156. data/lib/hydra/generic_content.rb +113 -0
  157. data/lib/hydra/generic_image.rb +100 -0
  158. data/lib/hydra/image.rb +177 -0
  159. data/lib/hydra/model_methods.rb +95 -0
  160. data/lib/hydra/model_mixins.rb +2 -0
  161. data/lib/hydra/model_mixins/common_metadata.rb +24 -0
  162. data/lib/hydra/model_mixins/mods_object.rb +16 -0
  163. data/lib/hydra/mods_article.rb +505 -0
  164. data/lib/hydra/mods_dataset.rb +165 -0
  165. data/lib/hydra/mods_generic_content.rb +494 -0
  166. data/lib/hydra/mods_image.rb +494 -0
  167. data/lib/hydra/repository_controller.rb +102 -0
  168. data/lib/hydra/rights_metadata.rb +189 -0
  169. data/lib/hydra/superuser_attributes.rb +12 -0
  170. data/lib/hydra/testing_server.rb +183 -0
  171. data/lib/hydra/user.rb +22 -0
  172. data/lib/mediashelf/active_fedora_helper.rb +72 -0
  173. data/lib/railties/all_tests.rake +23 -0
  174. data/lib/railties/hydra-fixtures.rake +184 -0
  175. data/lib/railties/hydra_jetty.rake +79 -0
  176. data/lib/railties/hyhead_cucumber.rake +127 -0
  177. data/lib/railties/hyhead_rspec.rake +137 -0
  178. data/lib/stanford/searchworks_helper.rb +1338 -0
  179. data/lib/stanford/solr_helper.rb +108 -0
  180. data/lib/uva/mods_index_methods.rb +24 -0
  181. data/solr_conf/conf/schema.xml +122 -0
  182. data/solr_conf/conf/solrconfig.xml +332 -0
  183. data/solr_conf/solr.xml +35 -0
  184. data/tasks/hydra-head-fixtures.rake +54 -0
  185. data/tasks/hydra-head.rake +247 -0
  186. data/tasks/hydra_jetty.rake +79 -0
  187. data/tasks/replicator.rake +27 -0
  188. data/tasks/solrizer-fedora.rake +53 -0
  189. data/tasks/solrizer.rake +13 -0
  190. data/test_support/etc/Gemfile +29 -0
  191. data/test_support/etc/rvmrc +32 -0
  192. data/test_support/features/button_add_assets.feature +22 -0
  193. data/test_support/features/button_add_generic_content.feature +11 -0
  194. data/test_support/features/button_add_image.feature +11 -0
  195. data/test_support/features/button_add_mods_asset.feature +11 -0
  196. data/test_support/features/contributor_add.feature +39 -0
  197. data/test_support/features/file_assets_list.feature +32 -0
  198. data/test_support/features/file_upload.feature +40 -0
  199. data/test_support/features/home_page.feature +9 -0
  200. data/test_support/features/html_validity.feature +47 -0
  201. data/test_support/features/mods_asset_contributors_edit.feature +80 -0
  202. data/test_support/features/mods_asset_create.feature +12 -0
  203. data/test_support/features/mods_asset_edit.feature +33 -0
  204. data/test_support/features/mods_asset_edit_without_permission.feature +10 -0
  205. data/test_support/features/mods_asset_search_result.feature +13 -0
  206. data/test_support/features/mods_asset_show.feature +39 -0
  207. data/test_support/features/permissions_add.feature +15 -0
  208. data/test_support/features/permissions_edit.feature +63 -0
  209. data/test_support/features/step_definitions/catalog_index_steps.rb +14 -0
  210. data/test_support/features/step_definitions/create_asset_steps.rb +7 -0
  211. data/test_support/features/step_definitions/edit_metadata_steps.rb +73 -0
  212. data/test_support/features/step_definitions/file_list_steps.rb +28 -0
  213. data/test_support/features/step_definitions/hydra_metadata_steps.rb +3 -0
  214. data/test_support/features/step_definitions/hydra_steps.rb +8 -0
  215. data/test_support/features/step_definitions/inline_editable_edit_steps.rb +77 -0
  216. data/test_support/features/step_definitions/search_steps.rb +88 -0
  217. data/test_support/features/step_definitions/searching_steps.rb +22 -0
  218. data/test_support/features/step_definitions/show_document_steps.rb +85 -0
  219. data/test_support/features/step_definitions/user_steps.rb +36 -0
  220. data/test_support/features/step_definitions/web_steps.rb +219 -0
  221. data/test_support/features/support/env.rb +55 -0
  222. data/test_support/features/support/paths.rb +80 -0
  223. data/test_support/features/switch_users.feature +14 -0
  224. data/test_support/features/view_catalog_index.feature +18 -0
  225. data/test_support/fixtures/empty_file.txt +0 -0
  226. data/test_support/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +1212 -0
  227. data/test_support/fixtures/hydrangea_fixture_file_asset1.foxml.xml +4946 -0
  228. data/test_support/fixtures/hydrangea_fixture_mods_article1.foxml.xml +234 -0
  229. data/test_support/fixtures/hydrangea_fixture_mods_article2.foxml.xml +177 -0
  230. data/test_support/fixtures/hydrangea_fixture_mods_article3.foxml.xml +170 -0
  231. data/test_support/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +187 -0
  232. data/test_support/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +676 -0
  233. data/test_support/fixtures/image.jp2 +0 -0
  234. data/test_support/fixtures/libra-oa_1.foxml.xml +2324 -0
  235. data/test_support/fixtures/libra-oa_2.foxml.xml +2422 -0
  236. data/test_support/spec/controllers/assets_controller_spec.rb +113 -0
  237. data/test_support/spec/controllers/catalog_controller_spec.rb +148 -0
  238. data/test_support/spec/controllers/catalog_controller_viewing_context_spec.rb +62 -0
  239. data/test_support/spec/controllers/contributors_controller_spec.rb +47 -0
  240. data/test_support/spec/controllers/file_assets_controller_spec.rb +189 -0
  241. data/test_support/spec/controllers/hydra_controller_spec.rb +15 -0
  242. data/test_support/spec/controllers/permissions_controller_spec.rb +80 -0
  243. data/test_support/spec/controllers/user_sessions_controller_spec.rb +35 -0
  244. data/test_support/spec/generators/hydra-head_generator_spec.rb +14 -0
  245. data/test_support/spec/helpers/access_controls_enforcement_spec.rb +212 -0
  246. data/test_support/spec/helpers/access_controls_evaluation_spec.rb +35 -0
  247. data/test_support/spec/helpers/assets_controller_helper_spec.rb +71 -0
  248. data/test_support/spec/helpers/blacklight_helper_spec.rb +64 -0
  249. data/test_support/spec/helpers/file_assets_helper_spec.rb +107 -0
  250. data/test_support/spec/helpers/hydra-repository_controller_spec.rb +32 -0
  251. data/test_support/spec/helpers/hydra_assets_helper_spec.rb +195 -0
  252. data/test_support/spec/helpers/hydra_djatoka_helper_spec.rb +32 -0
  253. data/test_support/spec/helpers/hydra_fedora_metadata_helper_spec.rb +215 -0
  254. data/test_support/spec/helpers/hydra_helper_spec.rb +73 -0
  255. data/test_support/spec/helpers/hydra_model_methods_spec.rb +95 -0
  256. data/test_support/spec/helpers/hydra_uploader_helper_spec.rb +18 -0
  257. data/test_support/spec/helpers/javascript_includes_helper_spec.rb +43 -0
  258. data/test_support/spec/integration/file_asset_spec.rb +150 -0
  259. data/test_support/spec/lib/active_fedora_helper_spec.rb +56 -0
  260. data/test_support/spec/lib/catalog_spec.rb +16 -0
  261. data/test_support/spec/lib/common_mods_index_methods_spec.rb +28 -0
  262. data/test_support/spec/models/audio_asset_spec.rb +23 -0
  263. data/test_support/spec/models/file_asset_spec.rb +42 -0
  264. data/test_support/spec/models/generic_content_spec.rb +29 -0
  265. data/test_support/spec/models/generic_image_spec.rb +58 -0
  266. data/test_support/spec/models/hydra_rights_metadata_spec.rb +162 -0
  267. data/test_support/spec/models/image_asset_spec.rb +23 -0
  268. data/test_support/spec/models/mods_asset_spec.rb +29 -0
  269. data/test_support/spec/models/role_mapper_spec.rb +22 -0
  270. data/test_support/spec/models/user_spec.rb +52 -0
  271. data/test_support/spec/models/video_asset_spec.rb +23 -0
  272. data/test_support/spec/rcov.opts +3 -0
  273. data/test_support/spec/spec.opts +4 -0
  274. data/test_support/spec/spec_helper.rb +44 -0
  275. data/test_support/spec/support/matchers/helper_matcher.rb +14 -0
  276. data/test_support/spec/support/matchers/solr_matchers.rb +60 -0
  277. data/test_support/spec/unit/hydra-head-engine_spec.rb +8 -0
  278. data/test_support/spec/unit/hydra-head_spec.rb +8 -0
  279. data/test_support/spec/utilities/hydra_testing_server_spec.rb +49 -0
  280. data/test_support/spec/views/uploader.html.erb_spec.rb +30 -0
  281. data/vendor/cache/RedCloth-4.2.3.gem +0 -0
  282. data/vendor/cache/abstract-1.0.0.gem +0 -0
  283. data/vendor/cache/actionmailer-3.0.9.gem +0 -0
  284. data/vendor/cache/actionpack-3.0.9.gem +0 -0
  285. data/vendor/cache/active-fedora-2.3.3.gem +0 -0
  286. data/vendor/cache/activemodel-3.0.9.gem +0 -0
  287. data/vendor/cache/activerecord-3.0.9.gem +0 -0
  288. data/vendor/cache/activeresource-3.0.9.gem +0 -0
  289. data/vendor/cache/activesupport-3.0.9.gem +0 -0
  290. data/vendor/cache/arel-2.0.10.gem +0 -0
  291. data/vendor/cache/blacklight-3.0.0.gem +0 -0
  292. data/vendor/cache/block_helpers-0.3.3.gem +0 -0
  293. data/vendor/cache/builder-2.1.2.gem +0 -0
  294. data/vendor/cache/capybara-1.0.0.gem +0 -0
  295. data/vendor/cache/childprocess-0.2.0.gem +0 -0
  296. data/vendor/cache/columnize-0.3.4.gem +0 -0
  297. data/vendor/cache/crack-0.1.8.gem +0 -0
  298. data/vendor/cache/cucumber-1.0.2.gem +0 -0
  299. data/vendor/cache/cucumber-rails-1.0.2.gem +0 -0
  300. data/vendor/cache/curb-0.7.15.gem +0 -0
  301. data/vendor/cache/daemons-1.1.4.gem +0 -0
  302. data/vendor/cache/database_cleaner-0.6.7.gem +0 -0
  303. data/vendor/cache/diff-lcs-1.1.2.gem +0 -0
  304. data/vendor/cache/equivalent-xml-0.2.7.gem +0 -0
  305. data/vendor/cache/erubis-2.6.6.gem +0 -0
  306. data/vendor/cache/facets-2.8.4.gem +0 -0
  307. data/vendor/cache/factory_girl-1.3.3.gem +0 -0
  308. data/vendor/cache/fastercsv-1.5.4.gem +0 -0
  309. data/vendor/cache/ffi-1.0.9.gem +0 -0
  310. data/vendor/cache/gherkin-2.4.5.gem +0 -0
  311. data/vendor/cache/haml-3.1.2.gem +0 -0
  312. data/vendor/cache/httparty-0.7.8.gem +0 -0
  313. data/vendor/cache/i18n-0.5.0.gem +0 -0
  314. data/vendor/cache/jettywrapper-0.0.10.gem +0 -0
  315. data/vendor/cache/json-1.5.3.gem +0 -0
  316. data/vendor/cache/json_pure-1.5.3.gem +0 -0
  317. data/vendor/cache/kaminari-0.12.4.gem +0 -0
  318. data/vendor/cache/launchy-2.0.3.gem +0 -0
  319. data/vendor/cache/linecache-0.46.gem +0 -0
  320. data/vendor/cache/logger-1.2.8.gem +0 -0
  321. data/vendor/cache/mail-2.2.19.gem +0 -0
  322. data/vendor/cache/marc-0.4.3.gem +0 -0
  323. data/vendor/cache/mediashelf-loggable-0.4.2.gem +0 -0
  324. data/vendor/cache/mime-types-1.16.gem +0 -0
  325. data/vendor/cache/mocha-0.9.12.gem +0 -0
  326. data/vendor/cache/multipart-post-1.1.2.gem +0 -0
  327. data/vendor/cache/nokogiri-1.5.0.gem +0 -0
  328. data/vendor/cache/om-1.2.5.gem +0 -0
  329. data/vendor/cache/polyglot-0.3.1.gem +0 -0
  330. data/vendor/cache/rack-1.2.3.gem +0 -0
  331. data/vendor/cache/rack-mount-0.6.14.gem +0 -0
  332. data/vendor/cache/rack-test-0.5.7.gem +0 -0
  333. data/vendor/cache/rails-3.0.9.gem +0 -0
  334. data/vendor/cache/railties-3.0.9.gem +0 -0
  335. data/vendor/cache/rake-0.9.2.gem +0 -0
  336. data/vendor/cache/rbx-require-relative-0.0.5.gem +0 -0
  337. data/vendor/cache/rcov-0.9.9.gem +0 -0
  338. data/vendor/cache/rdoc-3.8.gem +0 -0
  339. data/vendor/cache/rsolr-1.0.2.gem +0 -0
  340. data/vendor/cache/rsolr-ext-1.0.3.gem +0 -0
  341. data/vendor/cache/rspec-2.6.0.gem +0 -0
  342. data/vendor/cache/rspec-core-2.6.4.gem +0 -0
  343. data/vendor/cache/rspec-expectations-2.6.0.gem +0 -0
  344. data/vendor/cache/rspec-mocks-2.6.0.gem +0 -0
  345. data/vendor/cache/rspec-rails-2.6.1.gem +0 -0
  346. data/vendor/cache/ruby-debug-0.10.4.gem +0 -0
  347. data/vendor/cache/ruby-debug-base-0.10.4.gem +0 -0
  348. data/vendor/cache/rubyzip-0.9.4.gem +0 -0
  349. data/vendor/cache/sanitize-2.0.3.gem +0 -0
  350. data/vendor/cache/selenium-webdriver-0.2.2.gem +0 -0
  351. data/vendor/cache/solr-ruby-0.0.8.gem +0 -0
  352. data/vendor/cache/solrizer-1.1.0.gem +0 -0
  353. data/vendor/cache/solrizer-fedora-1.1.0.gem +0 -0
  354. data/vendor/cache/sqlite3-ruby-1.2.5.gem +0 -0
  355. data/vendor/cache/stomp-1.1.9.gem +0 -0
  356. data/vendor/cache/term-ansicolor-1.0.5.gem +0 -0
  357. data/vendor/cache/thor-0.14.6.gem +0 -0
  358. data/vendor/cache/treetop-1.4.9.gem +0 -0
  359. data/vendor/cache/trollop-1.16.2.gem +0 -0
  360. data/vendor/cache/tzinfo-0.3.29.gem +0 -0
  361. data/vendor/cache/unicode-0.4.0.gem +0 -0
  362. data/vendor/cache/will_paginate-2.3.15.gem +0 -0
  363. data/vendor/cache/xml-simple-1.1.0.gem +0 -0
  364. data/vendor/cache/xpath-0.1.4.gem +0 -0
  365. data/vendor/cache/yard-0.7.2.gem +0 -0
  366. metadata +1110 -0
@@ -0,0 +1,73 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require 'RedCloth'
3
+ include HydraHelper
4
+
5
+
6
+ describe HydraHelper do
7
+
8
+ describe "link_to_multifacet" do
9
+ #"box_facet"=>["7"]
10
+ it "should create a link to a catalog search with the desired facets" do
11
+ CGI.unescape(link_to_multifacet("my link", "series_facet" => "7", "box_facet" => ["41"])).should == "<a href=\"/catalog?f[box_facet][]=41&amp;f[series_facet][]=7\">my link</a>"
12
+ end
13
+ end
14
+
15
+ describe "get_html_data_with_label" do
16
+ before(:all) do
17
+ @default_html = " &lt;p&gt;Default Hello&lt;/p&gt;&lt;ol&gt;
18
+ &lt;li&gt;1&lt;/li&gt;
19
+ &lt;li&gt;2&lt;/li&gt;
20
+
21
+ &lt;li&gt;3&lt;/li&gt;
22
+ &lt;li&gt;
23
+ &lt;em&gt;strong&lt;/em&gt;
24
+ &lt;/li&gt;
25
+ &lt;/ol&gt;"
26
+ @sample_document = {'story_display' => [" &lt;p&gt;Hello&lt;/p&gt;&lt;ol&gt;
27
+ &lt;li&gt;1&lt;/li&gt;
28
+ &lt;li&gt;2&lt;/li&gt;
29
+
30
+ &lt;li&gt;3&lt;/li&gt;
31
+ &lt;li&gt;
32
+ &lt;em&gt;strong&lt;/em&gt;
33
+ &lt;/li&gt;
34
+ &lt;/ol&gt;"],'relation_t'=>['http://example.com','"Salt Dev":https://salt-dev.stanford.edu/catalog']}
35
+ end
36
+ it "should return unescaped html from story_display field" do
37
+ text = get_html_data_with_label(@sample_document,"Stories:", 'story_display')
38
+ text.should match(/^<dt>Stories:<\/dt><dd>/) and # Begin with <dt> label
39
+ text.should match(/<p>Hello<\/p>/) and # have HTML
40
+ text.should_not match(/&lt;p&gt;Hello&lt;\/p&gt;/) and #NOT have escaped html
41
+ text.should match(/<\/dd>$/) # ends with closing </dd>
42
+ end
43
+
44
+ it "should return unescaped html from default option if one is passed and the given field doesn't exist in the edoc" do
45
+ text = get_html_data_with_label(@sample_document,"Stories:", 'no_story_display',{:default=>@default_html})
46
+ text.should match(/^<dt>Stories:<\/dt><dd>/) and # Begin with <dt> label
47
+ text.should match(/<p>Default Hello<\/p>/) and # have HTML with Default in the text
48
+ text.should_not match(/<p>Hello<\/p>/) and # NOT have the text from the document
49
+ text.should_not match(/&lt;p&gt;Default Hello&lt;\/p&gt;/) and #NOT have escaped html
50
+ text.should match(/<\/dd>$/) # ends with closing </dd>
51
+ end
52
+ it "should return the unescaped document html if the given field exists even if the default option is passed" do
53
+ doc_text = get_html_data_with_label(@sample_document,"Stories:", 'story_display',{:default=>@default_html})
54
+ doc_text.should match(/<p>Hello<\/p>/) and
55
+ doc_text.should_not match(/<p>Default Hello<\/p>/)
56
+ end
57
+ end
58
+
59
+ describe "get_textile_data_with_label" do
60
+ before(:all) do
61
+ @sample_document = {'relation_t'=>['http://example.com','"Salt Dev":https://salt-dev.stanford.edu/catalog']}
62
+ end
63
+ it "should return html-rendered textile data" do
64
+ doc_text = get_textile_data_with_label(@sample_document,"Links:", 'relation_t')
65
+ doc_text.should match(/<dt>Links:<\/dt><dd>/) and
66
+ doc_text.should match(/<p>http:\/\/example.com<\/p>/) and
67
+ doc_text.should match(/<br\/>/) and
68
+ doc_text.should match('<p><a href="https://salt-dev.stanford.edu/catalog">Salt Dev</a></p><br/>') and
69
+ doc_text.should match(/<\/dd>/)
70
+ end
71
+ end
72
+
73
+ end
@@ -0,0 +1,95 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Hydra::ModelMethods do
4
+
5
+ describe "apply_depositor_metadata" do
6
+ it "should set the depositor metadata field and assign edit permissions to the given depositor_id" do
7
+ prop_ds = mock("properties ds")
8
+ rights_ds = mock("rights ds")
9
+ prop_ds.expects(:respond_to?).with(:depositor_values).returns(true)
10
+ prop_ds.expects(:depositor_values=).with("foouser")
11
+ rights_ds.expects(:update_indexed_attributes).with([:edit_access, :person]=>"foouser")
12
+
13
+ helper.stubs(:datastreams_in_memory).returns({"rightsMetadata"=>rights_ds,"properties"=>prop_ds})
14
+ helper.apply_depositor_metadata("foouser")
15
+ end
16
+ end
17
+
18
+ describe "set_title_and_label" do
19
+ before(:each) do
20
+ dm = mock("descMetadata")
21
+ helper.stubs(:datastreams).returns("descMetadata"=>dm)
22
+ end
23
+ it "should set the title and the label" do
24
+ helper.expects(:set_title)
25
+ helper.stubs(:label).returns(nil)
26
+ helper.expects(:label=).with("My title")
27
+ helper.set_title_and_label("My title")
28
+ end
29
+ it "should skip updating if the label is set already" do
30
+ helper.expects(:set_title).never
31
+ helper.expects(:label=).never
32
+ helper.stubs(:label).returns("pre existing label")
33
+ helper.set_title_and_label("My title", :only_if_blank=>true)
34
+ end
35
+ end
36
+
37
+ describe "set_title" do
38
+ it "should set the title if the descMetadata is a NokogiriDatastream that responds to :title term" do
39
+ dm = Hydra::ModsArticle.new
40
+ helper.stubs(:datastreams).returns("descMetadata"=>dm)
41
+ helper.set_title("My title")
42
+ dm.term_values(:title).should == ["My title"]
43
+ end
44
+ it "should set the title if the descMetadata is a MetadataDatastream with a title field defined" do
45
+ dm = ActiveFedora::QualifiedDublinCoreDatastream.new
46
+ helper.stubs(:datastreams).returns("descMetadata"=>dm)
47
+ helper.set_title("My title")
48
+ dm.title_values.should == ["My title"]
49
+ end
50
+ end
51
+
52
+ describe "set_collection_type" do
53
+ it "should set the collection metadata field" do
54
+ prop_ds = mock("properties ds")
55
+ prop_ds.expects(:respond_to?).with(:collection_values).returns(true)
56
+ prop_ds.expects(:collection_values=).with("mods_asset")
57
+
58
+ helper.stubs(:datastreams_in_memory).returns({"properties"=>prop_ds})
59
+ helper.set_collection_type("mods_asset")
60
+ end
61
+ end
62
+
63
+ describe "#destroyable_child_assets" do
64
+ it "should return an array of file assets available for deletion" do
65
+ ma = ModsAsset.load_instance("hydrangea:fixture_mods_article1")
66
+ deletable_assets = ma.destroyable_child_assets
67
+ deletable_assets.should be_a_kind_of Array
68
+ deletable_assets.length.should >= 1
69
+ deletable_assets.select {|a| a.pid == "hydrangea:fixture_uploaded_svg1"}[0].pid.should == "hydrangea:fixture_uploaded_svg1"
70
+ end
71
+ it "should return an empty array if there are now file assets" do
72
+ ma = ModsAsset.load_instance("hydrangea:fixture_mods_article2")
73
+ deletable_assets = ma.destroyable_child_assets
74
+ deletable_assets.should be_a_kind_of Array
75
+ deletable_assets.should be_empty
76
+ end
77
+ end
78
+
79
+ describe "#destroy_child_assets" do
80
+ it "should destroy any child assets and return an array listing the child assets" do
81
+ ma = ModsAsset.load_instance("hydrangea:fixture_mods_article1")
82
+ file_asset = mock("file object")
83
+ file_asset.expects(:pid).returns("hydrangea:fixture_uploaded_svg1")
84
+ file_asset.expects(:delete).returns(true)
85
+ ma.stubs(:destroyable_child_assets).returns([file_asset])
86
+ ma.destroy_child_assets.should == ["hydrangea:fixture_uploaded_svg1"]
87
+ end
88
+ it "should do nothing and return an empty array for an object with no child assets" do
89
+ ma = ModsAsset.load_instance("hydrangea:fixture_mods_article2")
90
+ ma.destroy_child_assets.should == []
91
+ end
92
+ end
93
+
94
+
95
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe HydraUploaderHelper do
4
+
5
+ describe "upload_url" do
6
+ it "should use container_id if its available" do
7
+ helper.stubs(:params).returns(:asset_id=>"foo:22")
8
+ helper.upload_url.should == "/assets/foo:22/file_assets"
9
+ end
10
+ it "should assume params[\"id\"] is pid of container when container_id is not set" do
11
+ helper.stubs(:params).returns(:controller=>"catalog", :action=>"show", :id=>"foo:25")
12
+ helper.upload_url.should == "/assets/foo:25/file_assets"
13
+ helper.stubs(:params).returns(:controller=>"assets", :action=>"show", :id=>"foo:25")
14
+ helper.upload_url.should == "/assets/foo:25/file_assets"
15
+ end
16
+ end
17
+
18
+ end
@@ -0,0 +1,43 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ include JavascriptIncludesHelper
3
+ # include HydraHelper # This helper provides the Controller's javascript_includes method
4
+
5
+ describe JavascriptIncludesHelper do
6
+
7
+ before(:each) do
8
+ # Mock behavior of Controller's javascript_includes method
9
+ @javascript_includes = []
10
+ helper.stubs(:javascript_includes).returns(@javascript_includes)
11
+ end
12
+
13
+ describe "include_javascript_for" do
14
+ it "should call custom helpers if they're defined" do
15
+ helper.expects(:include_javascript_for_hydrangea_articles_edit)
16
+ helper.include_javascript_for "hydrangea_articles", "edit"
17
+ end
18
+ it "should rely on default_javascript_includes when given content type is not explicitly covered" do
19
+ helper.expects(:include_default_javascript).with("edit")
20
+ helper.include_javascript_for "my_type", "edit"
21
+ end
22
+ it "should rely on default_javascript_includes when given action is not explicitly covered" do
23
+ helper.expects(:include_default_javascript).with("delete")
24
+ helper.include_javascript_for "catalog", "delete"
25
+ end
26
+ end
27
+
28
+ describe "include_default_javascript" do
29
+ it "should do nothing if no includes are defined for the given action" do
30
+ helper.expects(:javascript_includes).never
31
+ helper.include_default_javascript("flip")
32
+ end
33
+ it "should use catalog includes for edit" do
34
+ helper.expects(:include_javascript_for_catalog_edit)
35
+ helper.include_default_javascript("edit")
36
+ end
37
+ it "should use catalog includes for show" do
38
+ helper.expects(:include_javascript_for_catalog_show)
39
+ helper.include_default_javascript("show")
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,150 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require "active_fedora"
3
+
4
+ class DummyFileAsset < ActiveFedora::Base
5
+ def initialize(attr={})
6
+ super(attr)
7
+ add_relationship(:has_model, "info:fedora/afmodel:FileAsset")
8
+ end
9
+ end
10
+
11
+ describe FileAsset do
12
+ before(:each) do
13
+ @file_asset = FileAsset.new
14
+ @image_asset = ImageAsset.new
15
+ @audio_asset = AudioAsset.new
16
+ @video_asset = VideoAsset.new
17
+ @asset1 = ActiveFedora::Base.new
18
+ @asset2 = ActiveFedora::Base.new
19
+ @asset3 = ActiveFedora::Base.new
20
+ @dummy_file_asset = DummyFileAsset.new
21
+ @asset1.save
22
+ @asset2.save
23
+ @asset3.save
24
+ @image_asset.save
25
+ @audio_asset.save
26
+ @video_asset.save
27
+ @dummy_file_asset.save
28
+ end
29
+
30
+ after(:each) do
31
+ begin
32
+ @file_asset.delete
33
+ rescue
34
+ end
35
+ begin
36
+ @asset1.delete
37
+ rescue
38
+ end
39
+ begin
40
+ @asset2.delete
41
+ rescue
42
+ end
43
+ begin
44
+ @asset3.delete
45
+ rescue
46
+ end
47
+ begin
48
+ @image_asset.delete
49
+ rescue
50
+ end
51
+ begin
52
+ @audio_asset.delete
53
+ rescue
54
+ end
55
+ begin
56
+ @video_asset.delete
57
+ rescue
58
+ end
59
+ begin
60
+ @dummy_file_asset.delete
61
+ rescue
62
+ end
63
+ end
64
+
65
+ describe ".containers" do
66
+ it "should return asset container objects via either inbound has_collection_member, inbound has_part, or outbound is_part_of relationships" do
67
+ #test all possible combinations...
68
+ #none
69
+ @file_asset.containers(:response_format=>:id_array).should == []
70
+ #is_part_of
71
+ @file_asset.part_of_append(@asset1)
72
+ @file_asset.containers(:response_format=>:id_array).should == [@asset1.pid]
73
+ #has_part + is_part_of
74
+ @asset2.parts_append(@file_asset)
75
+ @asset2.save
76
+ @file_asset.containers(:response_format=>:id_array).should == [@asset2.pid,@asset1.pid]
77
+ #has_part
78
+ @file_asset.part_of_remove(@asset1)
79
+ @file_asset.containers(:response_format=>:id_array).should == [@asset2.pid]
80
+ #has_collection_member
81
+ @asset2.parts_remove(@file_asset)
82
+ @asset2.save
83
+ @asset3.collection_members_append(@file_asset)
84
+ @asset3.save
85
+ @file_asset.containers(:response_format=>:id_array).should == [@asset3.pid]
86
+ #is_part_of + has_collection_member
87
+ @file_asset.part_of_append(@asset1)
88
+ @file_asset.containers(:response_format=>:id_array).should == [@asset3.pid,@asset1.pid]
89
+ #has_part + has_collection_member
90
+ @file_asset.part_of_remove(@asset1)
91
+ @asset2.parts_append(@file_asset)
92
+ @asset2.save
93
+ @file_asset.containers(:response_format=>:id_array).should == [@asset3.pid,@asset2.pid]
94
+ #has_collection_member + has_part + is_part_of
95
+ @file_asset.part_of_append(@asset1)
96
+ @file_asset.containers(:response_format=>:id_array).should == [@asset3.pid,@asset2.pid,@asset1.pid]
97
+ end
98
+ end
99
+
100
+ describe ".containers_ids" do
101
+ it "should return an array of container ids instead of objects" do
102
+ #test all possible combinations...
103
+ #none
104
+ @file_asset.containers_ids.should == []
105
+ #is_part_of
106
+ @file_asset.part_of_append(@asset1)
107
+ @file_asset.containers_ids.should == [@asset1.pid]
108
+ end
109
+ end
110
+
111
+ describe ".to_solr" do
112
+ it "should load base fields correctly if active_fedora_model is FileAsset" do
113
+ @file_asset.update_indexed_attributes({:title=>{0=>"testing"}})
114
+ solr_doc = @file_asset.to_solr
115
+ solr_doc["title_t"].should == ["testing"]
116
+ end
117
+
118
+ it "should not load base fields twice for FileAsset if active_fedora_model is a class that is child of FileAsset" do
119
+ @image_asset.update_indexed_attributes({:title=>{0=>"testing"}})
120
+ #call Solrizer::Indexer.create_document since that produces the problem
121
+ @image_asset.save
122
+ solr_doc = ImageAsset.find_by_solr(@image_asset.pid).hits.first
123
+ solr_doc["title_t"].should == ["testing"]
124
+ @audio_asset.update_indexed_attributes({:title=>{0=>"testing"}})
125
+ #call Solrizer::Indexer.create_document since that produces the problem
126
+ @audio_asset.save
127
+ solr_doc = AudioAsset.find_by_solr(@audio_asset.pid).hits.first
128
+ solr_doc["title_t"].should == ["testing"]
129
+ @video_asset.update_indexed_attributes({:title=>{0=>"testing"}})
130
+ #call Solrizer::Indexer.create_document since that produces the problem
131
+ @video_asset.save
132
+ solr_doc = VideoAsset.find_by_solr(@video_asset.pid).hits.first
133
+ solr_doc["title_t"].should == ["testing"]
134
+ end
135
+
136
+ it "should load base fields for FileAsset for model_only if active_fedora_model is not FileAsset but is not child of FileAsset" do
137
+ file_asset = FileAsset.load_instance(@dummy_file_asset.pid)
138
+ ENABLE_SOLR_UPDATES = false
139
+ #it should save change to Fedora, but not solr
140
+ file_asset.update_indexed_attributes({:title=>{0=>"testing"}})
141
+ file_asset.save
142
+ ENABLE_SOLR_UPDATES = true
143
+ solr_doc = DummyFileAsset.find_by_solr(@dummy_file_asset.pid).hits.first
144
+ solr_doc["title_t"].nil?.should == true
145
+ @dummy_file_asset.update_index
146
+ solr_doc = DummyFileAsset.find_by_solr(@dummy_file_asset.pid).hits.first
147
+ solr_doc["title_t"].should == ["testing"]
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,56 @@
1
+ require File.expand_path( File.join( File.dirname(__FILE__),'..','spec_helper') )
2
+
3
+ require "hydra"
4
+
5
+ class FakeAssetsController
6
+ include MediaShelf::ActiveFedoraHelper
7
+ end
8
+
9
+ def helper
10
+ @fake_controller
11
+ end
12
+
13
+ describe MediaShelf::ActiveFedoraHelper do
14
+
15
+ before(:all) do
16
+ @fake_controller = FakeAssetsController.new
17
+ end
18
+
19
+ describe "retrieve_af_model" do
20
+ it "should return a Model class if the named model has been defined" do
21
+ result = helper.retrieve_af_model("file_asset")
22
+ result.should == FileAsset
23
+ result.superclass.should == ActiveFedora::Base
24
+ result.included_modules.should include(ActiveFedora::Model)
25
+ end
26
+
27
+ it "should accept camel cased OR underscored model name" do
28
+ result = helper.retrieve_af_model("generic_content")
29
+ result.should == GenericContent
30
+
31
+ result = helper.retrieve_af_model("GenericContent")
32
+ result.should == GenericContent
33
+
34
+ end
35
+
36
+ it "should return false if the name is not a real class" do
37
+ result = helper.retrieve_af_model("foo_foo_class_class")
38
+ result.should be_false
39
+ end
40
+
41
+ end
42
+
43
+ describe "load_af_instance_from_solr" do
44
+ it "should return an ActiveFedora object given a valid solr doc same as loading from Fedora" do
45
+ pid = "hydrangea:fixture_mods_article1"
46
+ result = ActiveFedora::Base.find_by_solr(pid)
47
+ solr_doc = result.hits.first
48
+ solr_af_obj = helper.load_af_instance_from_solr(solr_doc)
49
+ fed_af_obj = ActiveFedora::Base.load_instance(pid)
50
+ #check both inbound and outbound match
51
+ fed_af_obj.outbound_relationships.should == solr_af_obj.outbound_relationships
52
+ fed_af_obj.inbound_relationships.should == solr_af_obj.inbound_relationships
53
+ end
54
+ end
55
+
56
+ end
@@ -0,0 +1,16 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Hydra::Catalog do
4
+
5
+ before(:all) do
6
+ class CatalogTest < ApplicationController
7
+ include Hydra::Catalog
8
+ end
9
+ @catalog = CatalogTest.new
10
+ end
11
+
12
+ it "should extend classes with the necessary Hydra modules" do
13
+ CatalogTest.included_modules.should include(Hydra::AccessControlsEnforcement)
14
+ end
15
+
16
+ end