enju_flower 0.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (407) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +9 -0
  3. data/Rakefile +47 -0
  4. data/app/helpers/manifestations_helper.rb +176 -0
  5. data/app/views/manifestations/_all_facet.html.erb +8 -0
  6. data/app/views/manifestations/_attachment_file.html.erb +6 -0
  7. data/app/views/manifestations/_book_jacket.html.erb +5 -0
  8. data/app/views/manifestations/_call_number.html.erb +25 -0
  9. data/app/views/manifestations/_carrier_type_facet.html.erb +9 -0
  10. data/app/views/manifestations/_edition_and_number.html.erb +22 -0
  11. data/app/views/manifestations/_form.html.erb +156 -0
  12. data/app/views/manifestations/_history_list.html.erb +12 -0
  13. data/app/views/manifestations/_holding.html.erb +3 -0
  14. data/app/views/manifestations/_index_form.html.erb +12 -0
  15. data/app/views/manifestations/_index_form_contributor.html.erb +15 -0
  16. data/app/views/manifestations/_index_form_creator.html.erb +15 -0
  17. data/app/views/manifestations/_index_form_item.html.erb +14 -0
  18. data/app/views/manifestations/_index_form_manifestation.html.erb +13 -0
  19. data/app/views/manifestations/_index_form_publisher.html.erb +15 -0
  20. data/app/views/manifestations/_index_form_series_statement.html.erb +20 -0
  21. data/app/views/manifestations/_language_facet.html.erb +16 -0
  22. data/app/views/manifestations/_library_facet.html.erb +11 -0
  23. data/app/views/manifestations/_list.html.erb +21 -0
  24. data/app/views/manifestations/_manifestation.html.erb +73 -0
  25. data/app/views/manifestations/_manifestation_list.html.erb +32 -0
  26. data/app/views/manifestations/_not_found.html.erb +7 -0
  27. data/app/views/manifestations/_paginate_id_link.html.erb +30 -0
  28. data/app/views/manifestations/_pickup.html.erb +30 -0
  29. data/app/views/manifestations/_pub_year_facet.html.erb +11 -0
  30. data/app/views/manifestations/_question_list.html.erb +13 -0
  31. data/app/views/manifestations/_reservable_facet.html.erb +14 -0
  32. data/app/views/manifestations/_search_engine.html.erb +16 -0
  33. data/app/views/manifestations/_serial_form.html.erb +14 -0
  34. data/app/views/manifestations/_session_ids.html.erb +10 -0
  35. data/app/views/manifestations/_show.mods.builder +86 -0
  36. data/app/views/manifestations/_show.rdf.builder +63 -0
  37. data/app/views/manifestations/_show_creators.html.erb +17 -0
  38. data/app/views/manifestations/_show_creators.mobile.erb +17 -0
  39. data/app/views/manifestations/_show_detail_librarian.html.erb +135 -0
  40. data/app/views/manifestations/_show_detail_user.html.erb +130 -0
  41. data/app/views/manifestations/_show_group.html.erb +2 -0
  42. data/app/views/manifestations/_show_holding.html.erb +60 -0
  43. data/app/views/manifestations/_show_holding.mobile.erb +38 -0
  44. data/app/views/manifestations/_show_index.html.erb +21 -0
  45. data/app/views/manifestations/_show_index.mobile.erb +14 -0
  46. data/app/views/manifestations/_show_periodical_master.html.erb +40 -0
  47. data/app/views/manifestations/_show_series_index.html.erb +15 -0
  48. data/app/views/manifestations/_show_series_statement.html.erb +30 -0
  49. data/app/views/manifestations/_submenu_series_statement.html.erb +9 -0
  50. data/app/views/manifestations/_tab_list.html.erb +11 -0
  51. data/app/views/manifestations/_tab_menu.html.erb +14 -0
  52. data/app/views/manifestations/_title.html.erb +27 -0
  53. data/app/views/manifestations/_title.mobile.erb +27 -0
  54. data/app/views/manifestations/edit.html.erb +21 -0
  55. data/app/views/manifestations/error.xml +7 -0
  56. data/app/views/manifestations/explain.sru +9 -0
  57. data/app/views/manifestations/index.atom.builder +19 -0
  58. data/app/views/manifestations/index.csv.erb +4 -0
  59. data/app/views/manifestations/index.html.erb +112 -0
  60. data/app/views/manifestations/index.mobile.erb +21 -0
  61. data/app/views/manifestations/index.mods.builder +8 -0
  62. data/app/views/manifestations/index.opds.builder +24 -0
  63. data/app/views/manifestations/index.rdf.builder +30 -0
  64. data/app/views/manifestations/index.rss.builder +43 -0
  65. data/app/views/manifestations/index.sru.builder +101 -0
  66. data/app/views/manifestations/new.html.erb +16 -0
  67. data/app/views/manifestations/show.html.erb +108 -0
  68. data/app/views/manifestations/show.mobile.erb +20 -0
  69. data/app/views/manifestations/show.mods.builder +6 -0
  70. data/app/views/manifestations/show.rdf.builder +12 -0
  71. data/config/routes.rb +2 -0
  72. data/lib/enju_flower/engine.rb +4 -0
  73. data/lib/enju_flower/version.rb +3 -0
  74. data/lib/enju_flower.rb +4 -0
  75. data/lib/generators/enju_flower/views_generator.rb +17 -0
  76. data/lib/tasks/enju_flower_tasks.rake +4 -0
  77. data/spec/controllers/manifestations_controller_spec.rb +685 -0
  78. data/spec/dummy/README.rdoc +261 -0
  79. data/spec/dummy/Rakefile +7 -0
  80. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  81. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  82. data/spec/dummy/app/controllers/application_controller.rb +184 -0
  83. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  84. data/spec/dummy/app/mailers/notifier.rb +40 -0
  85. data/spec/dummy/app/models/ability.rb +186 -0
  86. data/spec/dummy/app/models/local_patron.rb +27 -0
  87. data/spec/dummy/app/models/role.rb +46 -0
  88. data/spec/dummy/app/models/setting.rb +4 -0
  89. data/spec/dummy/app/models/user.rb +102 -0
  90. data/spec/dummy/app/models/user_group.rb +40 -0
  91. data/spec/dummy/app/models/user_has_role.rb +5 -0
  92. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  93. data/spec/dummy/app/views/page/403.html.erb +9 -0
  94. data/spec/dummy/app/views/page/403.mobile.erb +5 -0
  95. data/spec/dummy/app/views/page/403.xml.erb +4 -0
  96. data/spec/dummy/app/views/page/404.html.erb +9 -0
  97. data/spec/dummy/app/views/page/404.mobile.erb +5 -0
  98. data/spec/dummy/app/views/page/404.xml.erb +4 -0
  99. data/spec/dummy/app/views/page/_footer.html.erb +4 -0
  100. data/spec/dummy/app/views/page/_header.html.erb +2 -0
  101. data/spec/dummy/app/views/page/_include.html.erb +4 -0
  102. data/spec/dummy/app/views/page/_menu.html.erb +2 -0
  103. data/spec/dummy/app/views/page/_select_locale.html.erb +2 -0
  104. data/spec/dummy/config/application.rb +64 -0
  105. data/spec/dummy/config/application.yml +42 -0
  106. data/spec/dummy/config/boot.rb +10 -0
  107. data/spec/dummy/config/database.yml +25 -0
  108. data/spec/dummy/config/environment.rb +5 -0
  109. data/spec/dummy/config/environments/development.rb +37 -0
  110. data/spec/dummy/config/environments/production.rb +67 -0
  111. data/spec/dummy/config/environments/test.rb +37 -0
  112. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  113. data/spec/dummy/config/initializers/devise.rb +205 -0
  114. data/spec/dummy/config/initializers/inflections.rb +15 -0
  115. data/spec/dummy/config/initializers/mime_types.rb +10 -0
  116. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  117. data/spec/dummy/config/initializers/session_store.rb +8 -0
  118. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  119. data/spec/dummy/config/locales/en.yml +5 -0
  120. data/spec/dummy/config/routes.rb +60 -0
  121. data/spec/dummy/config.ru +4 -0
  122. data/spec/dummy/db/migrate/001_create_patrons.rb +53 -0
  123. data/spec/dummy/db/migrate/005_create_manifestations.rb +56 -0
  124. data/spec/dummy/db/migrate/006_create_items.rb +28 -0
  125. data/spec/dummy/db/migrate/012_create_owns.rb +12 -0
  126. data/spec/dummy/db/migrate/015_create_creates.rb +12 -0
  127. data/spec/dummy/db/migrate/032_create_checkins.rb +17 -0
  128. data/spec/dummy/db/migrate/033_create_checkouts.rb +25 -0
  129. data/spec/dummy/db/migrate/035_create_reserves.rb +27 -0
  130. data/spec/dummy/db/migrate/047_create_produces.rb +12 -0
  131. data/spec/dummy/db/migrate/055_create_bookmarks.rb +22 -0
  132. data/spec/dummy/db/migrate/059_create_libraries.rb +28 -0
  133. data/spec/dummy/db/migrate/069_create_shelves.rb +15 -0
  134. data/spec/dummy/db/migrate/073_create_carrier_types.rb +11 -0
  135. data/spec/dummy/db/migrate/077_create_user_groups.rb +16 -0
  136. data/spec/dummy/db/migrate/080_create_library_groups.rb +20 -0
  137. data/spec/dummy/db/migrate/112_create_frequencies.rb +12 -0
  138. data/spec/dummy/db/migrate/113_create_events.rb +23 -0
  139. data/spec/dummy/db/migrate/114_create_event_categories.rb +16 -0
  140. data/spec/dummy/db/migrate/117_create_form_of_works.rb +12 -0
  141. data/spec/dummy/db/migrate/120_create_baskets.rb +12 -0
  142. data/spec/dummy/db/migrate/121_create_checked_items.rb +17 -0
  143. data/spec/dummy/db/migrate/124_create_bookstores.rb +17 -0
  144. data/spec/dummy/db/migrate/125_create_donates.rb +12 -0
  145. data/spec/dummy/db/migrate/127_create_use_restrictions.rb +16 -0
  146. data/spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb +16 -0
  147. data/spec/dummy/db/migrate/130_create_request_status_types.rb +12 -0
  148. data/spec/dummy/db/migrate/131_create_request_types.rb +12 -0
  149. data/spec/dummy/db/migrate/132_create_circulation_statuses.rb +16 -0
  150. data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
  151. data/spec/dummy/db/migrate/154_create_messages.rb +24 -0
  152. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +20 -0
  153. data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +13 -0
  154. data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +13 -0
  155. data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +12 -0
  156. data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +17 -0
  157. data/spec/dummy/db/migrate/20081025083323_create_countries.rb +28 -0
  158. data/spec/dummy/db/migrate/20081025083905_create_languages.rb +23 -0
  159. data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +15 -0
  160. data/spec/dummy/db/migrate/20081028083142_create_patron_import_files.rb +22 -0
  161. data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +22 -0
  162. data/spec/dummy/db/migrate/20081028093607_create_event_import_files.rb +27 -0
  163. data/spec/dummy/db/migrate/20081030023412_create_checkout_types.rb +17 -0
  164. data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +25 -0
  165. data/spec/dummy/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb +18 -0
  166. data/spec/dummy/db/migrate/20081117143156_create_inventory_files.rb +18 -0
  167. data/spec/dummy/db/migrate/20081117143455_create_inventories.rb +17 -0
  168. data/spec/dummy/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb +17 -0
  169. data/spec/dummy/db/migrate/20081212080038_create_manifestation_checkout_stats.rb +16 -0
  170. data/spec/dummy/db/migrate/20081212151614_create_bookmark_stats.rb +16 -0
  171. data/spec/dummy/db/migrate/20081212151820_create_bookmark_stat_has_manifestations.rb +13 -0
  172. data/spec/dummy/db/migrate/20081215094302_create_user_checkout_stats.rb +16 -0
  173. data/spec/dummy/db/migrate/20081215094955_create_checkout_stat_has_users.rb +17 -0
  174. data/spec/dummy/db/migrate/20081216190517_create_reserve_stat_has_manifestations.rb +17 -0
  175. data/spec/dummy/db/migrate/20081216190724_create_manifestation_reserve_stats.rb +16 -0
  176. data/spec/dummy/db/migrate/20081220023628_create_user_reserve_stats.rb +16 -0
  177. data/spec/dummy/db/migrate/20081220034117_create_reserve_stat_has_users.rb +17 -0
  178. data/spec/dummy/db/migrate/20090321130448_add_completed_at_to_user_checkout_stat.rb +27 -0
  179. data/spec/dummy/db/migrate/20090519203307_create_participates.rb +17 -0
  180. data/spec/dummy/db/migrate/20090705133942_add_attachments_picture_to_picture_file.rb +15 -0
  181. data/spec/dummy/db/migrate/20090705212043_add_attachments_attachment_to_manifestation.rb +15 -0
  182. data/spec/dummy/db/migrate/20090706125521_add_attachments_inventory_to_inventory_file.rb +15 -0
  183. data/spec/dummy/db/migrate/20090719201843_create_extents.rb +12 -0
  184. data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +12 -0
  185. data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +12 -0
  186. data/spec/dummy/db/migrate/20090812151902_create_patron_relationship_types.rb +12 -0
  187. data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +21 -0
  188. data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +27 -0
  189. data/spec/dummy/db/migrate/20091025080447_create_licenses.rb +12 -0
  190. data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
  191. data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +13 -0
  192. data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +15 -0
  193. data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +9 -0
  194. data/spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb +13 -0
  195. data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +10 -0
  196. data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +13 -0
  197. data/spec/dummy/db/migrate/20100525171356_acts_as_taggable_on_migration.rb +30 -0
  198. data/spec/dummy/db/migrate/20100527113752_create_delayed_jobs.rb +21 -0
  199. data/spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb +13 -0
  200. data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +12 -0
  201. data/spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb +11 -0
  202. data/spec/dummy/db/migrate/20100925043847_create_resource_import_results.rb +15 -0
  203. data/spec/dummy/db/migrate/20100925074559_create_patron_import_results.rb +12 -0
  204. data/spec/dummy/db/migrate/20100925074639_create_event_import_results.rb +15 -0
  205. data/spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb +9 -0
  206. data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
  207. data/spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb +9 -0
  208. data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +11 -0
  209. data/spec/dummy/db/migrate/20110301134521_add_expire_date_to_reserve.rb +9 -0
  210. data/spec/dummy/db/migrate/20110318183304_add_valid_period_for_new_user_to_user_group.rb +13 -0
  211. data/spec/dummy/db/migrate/20110328130826_add_current_checkout_count_to_user_group_has_checkout_type.rb +9 -0
  212. data/spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb +9 -0
  213. data/spec/dummy/db/migrate/20110603184217_add_edit_mode_to_resource_import_file.rb +9 -0
  214. data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +9 -0
  215. data/spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb +9 -0
  216. data/spec/dummy/db/migrate/20110620173525_add_bookstore_id_to_item.rb +11 -0
  217. data/spec/dummy/db/migrate/20110621093332_remove_expire_date_from_reserve.rb +9 -0
  218. data/spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb +9 -0
  219. data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +12 -0
  220. data/spec/dummy/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +13 -0
  221. data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +13 -0
  222. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
  223. data/spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +13 -0
  224. data/spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb +13 -0
  225. data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +10 -0
  226. data/spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +13 -0
  227. data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +9 -0
  228. data/spec/dummy/db/migrate/20111009183423_add_ndc_to_manifestation.rb +9 -0
  229. data/spec/dummy/db/migrate/20111124110059_create_create_types.rb +12 -0
  230. data/spec/dummy/db/migrate/20111124110319_create_realize_types.rb +12 -0
  231. data/spec/dummy/db/migrate/20111124110355_create_produce_types.rb +12 -0
  232. data/spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb +7 -0
  233. data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
  234. data/spec/dummy/db/migrate/20111201155456_create_users.rb +16 -0
  235. data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +44 -0
  236. data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
  237. data/spec/dummy/db/migrate/20111217234412_add_save_checkout_history_to_user.rb +5 -0
  238. data/spec/dummy/db/migrate/20111218002349_add_checkout_icalendar_token_to_user.rb +6 -0
  239. data/spec/dummy/db/migrate/20111231145823_add_share_bookmarks_to_user.rb +5 -0
  240. data/spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb +5 -0
  241. data/spec/dummy/db/migrate/20120105101944_add_queue_to_delayed_jobs.rb +9 -0
  242. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
  243. data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +6 -0
  244. data/spec/dummy/db/migrate/20120129014038_create_budget_types.rb +12 -0
  245. data/spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb +6 -0
  246. data/spec/dummy/db/migrate/20120319120638_add_content_type_id_to_manifestation.rb +6 -0
  247. data/spec/dummy/db/migrate/20120410104851_add_year_of_publication_to_manifestation.rb +5 -0
  248. data/spec/dummy/db/migrate/20120413051535_add_event_import_fingerprint_to_event_import_file.rb +5 -0
  249. data/spec/dummy/db/migrate/20120413072700_add_picture_meta_to_picture_file.rb +5 -0
  250. data/spec/dummy/db/migrate/20120413100352_add_fingerprint_to_picture_file.rb +5 -0
  251. data/spec/dummy/db/migrate/20120413100431_add_fingerprint_to_inventory_file.rb +5 -0
  252. data/spec/dummy/db/migrate/20120413161340_add_fingerprint_to_resource_import_file.rb +5 -0
  253. data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +5 -0
  254. data/spec/dummy/db/migrate/20120413170705_add_error_message_to_resource_import_file.rb +5 -0
  255. data/spec/dummy/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +5 -0
  256. data/spec/dummy/db/migrate/20120413170734_add_error_message_to_event_import_file.rb +5 -0
  257. data/spec/dummy/db/migrate/20120415060308_rename_resource_import_file_imported_at_to_executed_at.rb +9 -0
  258. data/spec/dummy/db/migrate/20120415060323_rename_patron_import_file_imported_at_to_executed_at.rb +9 -0
  259. data/spec/dummy/db/migrate/20120415060342_rename_event_import_file_imported_at_to_executed_at.rb +9 -0
  260. data/spec/dummy/db/migrate/20120415164821_add_attachment_meta_to_manifestation.rb +5 -0
  261. data/spec/dummy/db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb +5 -0
  262. data/spec/dummy/db/migrate/20120424103932_add_librarian_id_to_checked_item.rb +5 -0
  263. data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +5 -0
  264. data/spec/dummy/db/migrate/20120511072422_add_patron_identifier_to_patron.rb +6 -0
  265. data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +5 -0
  266. data/spec/dummy/db/migrate/20120728204337_create_series_statement_relationships.rb +11 -0
  267. data/spec/dummy/db/migrate/20121116031206_add_fulltext_content_to_manifestation.rb +5 -0
  268. data/spec/dummy/db/migrate/20121116033446_add_doi_to_manifestation.rb +6 -0
  269. data/spec/dummy/db/migrate/20121119153944_add_manifestation_id_to_item.rb +5 -0
  270. data/spec/dummy/db/schema.rb +1240 -0
  271. data/spec/dummy/db/test.sqlite3 +0 -0
  272. data/spec/dummy/lib/plugins/ext/event-calendar.rb +38 -0
  273. data/spec/dummy/lib/plugins/ext/sunspot/abstract_search.rb +12 -0
  274. data/spec/dummy/lib/plugins/ext/sunspot/dismax.rb +41 -0
  275. data/spec/dummy/lib/plugins/ext/sunspot/start_record.rb +55 -0
  276. data/spec/dummy/lib/plugins/ext/sunspot.rb +3 -0
  277. data/spec/dummy/lib/plugins/ext.rb +1 -0
  278. data/spec/dummy/lib/plugins.rb +2 -0
  279. data/spec/dummy/public/404.html +26 -0
  280. data/spec/dummy/public/422.html +26 -0
  281. data/spec/dummy/public/500.html +25 -0
  282. data/spec/dummy/public/favicon.ico +0 -0
  283. data/spec/dummy/script/rails +6 -0
  284. data/spec/dummy/solr/conf/admin-extra.html +31 -0
  285. data/spec/dummy/solr/conf/elevate.xml +36 -0
  286. data/spec/dummy/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  287. data/spec/dummy/solr/conf/protwords.txt +21 -0
  288. data/spec/dummy/solr/conf/schema.xml +251 -0
  289. data/spec/dummy/solr/conf/scripts.conf +24 -0
  290. data/spec/dummy/solr/conf/solrconfig.xml +934 -0
  291. data/spec/dummy/solr/conf/spellings.txt +2 -0
  292. data/spec/dummy/solr/conf/stopwords.txt +58 -0
  293. data/spec/dummy/solr/conf/synonyms.txt +31 -0
  294. data/spec/dummy/solr/data/test/index/_ev.fdt +0 -0
  295. data/spec/dummy/solr/data/test/index/_ev.fdx +0 -0
  296. data/spec/dummy/solr/data/test/index/_ev.fnm +7 -0
  297. data/spec/dummy/solr/data/test/index/_ev.frq +0 -0
  298. data/spec/dummy/solr/data/test/index/_ev.nrm +1 -0
  299. data/spec/dummy/solr/data/test/index/_ev.prx +0 -0
  300. data/spec/dummy/solr/data/test/index/_ev.tii +0 -0
  301. data/spec/dummy/solr/data/test/index/_ev.tis +0 -0
  302. data/spec/dummy/solr/data/test/index/_ew.fdt +0 -0
  303. data/spec/dummy/solr/data/test/index/_ew.fdx +0 -0
  304. data/spec/dummy/solr/data/test/index/_ew.fnm +7 -0
  305. data/spec/dummy/solr/data/test/index/_ew.frq +0 -0
  306. data/spec/dummy/solr/data/test/index/_ew.nrm +1 -0
  307. data/spec/dummy/solr/data/test/index/_ew.prx +0 -0
  308. data/spec/dummy/solr/data/test/index/_ew.tii +0 -0
  309. data/spec/dummy/solr/data/test/index/_ew.tis +0 -0
  310. data/spec/dummy/solr/data/test/index/_ex.fdt +0 -0
  311. data/spec/dummy/solr/data/test/index/_ex.fdx +0 -0
  312. data/spec/dummy/solr/data/test/index/_ex.fnm +8 -0
  313. data/spec/dummy/solr/data/test/index/_ex.frq +0 -0
  314. data/spec/dummy/solr/data/test/index/_ex.nrm +1 -0
  315. data/spec/dummy/solr/data/test/index/_ex.prx +0 -0
  316. data/spec/dummy/solr/data/test/index/_ex.tii +0 -0
  317. data/spec/dummy/solr/data/test/index/_ex.tis +0 -0
  318. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  319. data/spec/dummy/solr/data/test/index/segments_jz +0 -0
  320. data/spec/dummy/solr/data/test/spellchecker/segments.gen +0 -0
  321. data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
  322. data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
  323. data/spec/dummy/tmp/cache/6E4/420/search_engine_all +0 -0
  324. data/spec/factories/basket.rb +5 -0
  325. data/spec/factories/carrier_type.rb +5 -0
  326. data/spec/factories/content_type.rb +5 -0
  327. data/spec/factories/country.rb +8 -0
  328. data/spec/factories/create.rb +6 -0
  329. data/spec/factories/create_types.rb +9 -0
  330. data/spec/factories/donate.rb +6 -0
  331. data/spec/factories/exemplify.rb +6 -0
  332. data/spec/factories/extent.rb +5 -0
  333. data/spec/factories/form_of_work.rb +5 -0
  334. data/spec/factories/frequency.rb +5 -0
  335. data/spec/factories/import_request.rb +5 -0
  336. data/spec/factories/item.rb +7 -0
  337. data/spec/factories/language.rb +8 -0
  338. data/spec/factories/license.rb +5 -0
  339. data/spec/factories/manifestation.rb +6 -0
  340. data/spec/factories/manifestation_relationship.rb +6 -0
  341. data/spec/factories/manifestation_relationship_type.rb +5 -0
  342. data/spec/factories/medium_of_performance.rb +5 -0
  343. data/spec/factories/own.rb +6 -0
  344. data/spec/factories/patron.rb +13 -0
  345. data/spec/factories/patron_relationship.rb +6 -0
  346. data/spec/factories/patron_relationship_type.rb +5 -0
  347. data/spec/factories/patron_type.rb +5 -0
  348. data/spec/factories/produce.rb +6 -0
  349. data/spec/factories/produce_types.rb +9 -0
  350. data/spec/factories/realize.rb +6 -0
  351. data/spec/factories/realize_types.rb +9 -0
  352. data/spec/factories/series_has_manifestation.rb +6 -0
  353. data/spec/factories/series_statement.rb +5 -0
  354. data/spec/factories/series_statement_relationship.rb +8 -0
  355. data/spec/factories/user.rb +37 -0
  356. data/spec/fixtures/baskets.yml +80 -0
  357. data/spec/fixtures/bookstores.yml +107 -0
  358. data/spec/fixtures/budget_types.yml +29 -0
  359. data/spec/fixtures/carrier_types.yml +51 -0
  360. data/spec/fixtures/content_types.yml +36 -0
  361. data/spec/fixtures/countries.yml +2059 -0
  362. data/spec/fixtures/create_types.yml +47 -0
  363. data/spec/fixtures/creates.yml +64 -0
  364. data/spec/fixtures/donates.yml +31 -0
  365. data/spec/fixtures/exemplifies.yml +160 -0
  366. data/spec/fixtures/extents.yml +29 -0
  367. data/spec/fixtures/form_of_works.yml +39 -0
  368. data/spec/fixtures/frequencies.yml +85 -0
  369. data/spec/fixtures/import_requests.yml +27 -0
  370. data/spec/fixtures/items.yml +259 -0
  371. data/spec/fixtures/languages.yml +1901 -0
  372. data/spec/fixtures/libraries.yml +102 -0
  373. data/spec/fixtures/library_groups.yml +33 -0
  374. data/spec/fixtures/licenses.yml +29 -0
  375. data/spec/fixtures/manifestation_relationship_types.yml +29 -0
  376. data/spec/fixtures/manifestation_relationships.yml +30 -0
  377. data/spec/fixtures/manifestations.yml +2022 -0
  378. data/spec/fixtures/medium_of_performances.yml +29 -0
  379. data/spec/fixtures/owns.yml +26 -0
  380. data/spec/fixtures/patron_import_files.yml +47 -0
  381. data/spec/fixtures/patron_import_results.yml +29 -0
  382. data/spec/fixtures/patron_relationship_types.yml +34 -0
  383. data/spec/fixtures/patron_relationships.yml +25 -0
  384. data/spec/fixtures/patron_types.yml +35 -0
  385. data/spec/fixtures/patrons.yml +334 -0
  386. data/spec/fixtures/picture_files.yml +63 -0
  387. data/spec/fixtures/produce_types.yml +31 -0
  388. data/spec/fixtures/produces.yml +148 -0
  389. data/spec/fixtures/realize_types.yml +39 -0
  390. data/spec/fixtures/realizes.yml +85 -0
  391. data/spec/fixtures/request_status_types.yml +63 -0
  392. data/spec/fixtures/request_types.yml +55 -0
  393. data/spec/fixtures/resource_import_files.yml +47 -0
  394. data/spec/fixtures/resource_import_results.yml +29 -0
  395. data/spec/fixtures/roles.yml +21 -0
  396. data/spec/fixtures/series_has_manifestations.yml +35 -0
  397. data/spec/fixtures/series_statements.yml +45 -0
  398. data/spec/fixtures/shelves.yml +47 -0
  399. data/spec/fixtures/user_groups.yml +51 -0
  400. data/spec/fixtures/user_has_roles.yml +41 -0
  401. data/spec/fixtures/users.yml +106 -0
  402. data/spec/spec_helper.rb +53 -0
  403. data/spec/support/controller_macros.rb +46 -0
  404. data/spec/support/devise.rb +4 -0
  405. data/vendor/assets/javascripts/jquery.mobile-1.3.0.js +11092 -0
  406. data/vendor/assets/stylesheets/jquery.mobile-1.3.0.css +3357 -0
  407. metadata +942 -0
@@ -0,0 +1,685 @@
1
+ require 'spec_helper'
2
+
3
+ describe ManifestationsController do
4
+ fixtures :all
5
+
6
+ def valid_attributes
7
+ FactoryGirl.attributes_for(:manifestation)
8
+ end
9
+
10
+ describe "GET index", :solr => true do
11
+ before do
12
+ Manifestation.reindex
13
+ end
14
+
15
+ describe "When logged in as Administrator" do
16
+ login_admin
17
+
18
+ it "assigns all manifestations as @manifestations" do
19
+ get :index
20
+ assigns(:manifestations).should_not be_nil
21
+ end
22
+ end
23
+
24
+ describe "When logged in as Librarian" do
25
+ login_librarian
26
+
27
+ it "assigns all manifestations as @manifestations" do
28
+ get :index
29
+ assigns(:manifestations).should_not be_nil
30
+ end
31
+ end
32
+
33
+ describe "When logged in as User" do
34
+ login_user
35
+
36
+ it "assigns all manifestations as @manifestations" do
37
+ get :index
38
+ assigns(:manifestations).should_not be_nil
39
+ end
40
+ end
41
+
42
+ describe "When not logged in" do
43
+ it "assigns all manifestations as @manifestations" do
44
+ get :index
45
+ assigns(:manifestations).should_not be_nil
46
+ end
47
+
48
+ it "assigns all manifestations as @manifestations in xml format without operation" do
49
+ get :index, :format => 'xml'
50
+ response.should be_success
51
+ assigns(:manifestations).should_not be_nil
52
+ end
53
+
54
+ it "assigns all manifestations as @manifestations in csv format without operation" do
55
+ get :index, :format => 'csv'
56
+ response.should be_success
57
+ assigns(:manifestations).should_not be_nil
58
+ response.should render_template('manifestations/index')
59
+ end
60
+
61
+ it "assigns all manifestations as @manifestations in sru format without operation" do
62
+ get :index, :format => 'sru'
63
+ assert_response :success
64
+ assigns(:manifestations).should be_nil
65
+ response.should render_template('manifestations/explain')
66
+ end
67
+
68
+ it "assigns all manifestations as @manifestations in sru format with operation" do
69
+ get :index, :format => 'sru', :operation => 'searchRetrieve', :query => 'ruby'
70
+ assigns(:manifestations).should_not be_nil
71
+ response.should render_template('manifestations/index')
72
+ end
73
+
74
+ it "assigns all manifestations as @manifestations in sru format with operation and title" do
75
+ get :index, :format => 'sru', :query => 'title=ruby', :operation => 'searchRetrieve'
76
+ assigns(:manifestations).should_not be_nil
77
+ response.should render_template('manifestations/index')
78
+ end
79
+
80
+ it "assigns all manifestations as @manifestations in openurl" do
81
+ get :index, :api => 'openurl', :title => 'ruby'
82
+ assigns(:manifestations).should_not be_nil
83
+ end
84
+
85
+ it "assigns all manifestations as @manifestations when pub_date_from and pub_date_to are specified" do
86
+ get :index, :pub_date_from => '2000', :pub_date_to => '2007'
87
+ assigns(:query).should eq "date_of_publication_d:[#{Time.zone.parse('2000-01-01').utc.iso8601} TO #{Time.zone.parse('2007-12-31').end_of_year.utc.iso8601}]"
88
+ assigns(:manifestations).should_not be_nil
89
+ end
90
+
91
+ it "assigns all manifestations as @manifestations when acquired_from and pub_date_to are specified" do
92
+ get :index, :acquired_from => '2000', :acquired_to => '2007'
93
+ assigns(:query).should eq "acquired_at_d:[#{Time.zone.parse('2000-01-01').utc.iso8601} TO #{Time.zone.parse('2007-12-31').end_of_day.utc.iso8601}]"
94
+ assigns(:manifestations).should_not be_nil
95
+ end
96
+
97
+ it "assigns all manifestations as @manifestations when number_of_pages_at_least and number_of_pages_at_most are specified" do
98
+ get :index, :number_of_pages_at_least => '100', :number_of_pages_at_least => '200'
99
+ assigns(:manifestations).should_not be_nil
100
+ end
101
+
102
+ it "assigns all manifestations as @manifestations in mods format" do
103
+ get :index, :format => 'mods'
104
+ assigns(:manifestations).should_not be_nil
105
+ response.should render_template("manifestations/index")
106
+ end
107
+
108
+ it "assigns all manifestations as @manifestations in rdf format" do
109
+ get :index, :format => 'rdf'
110
+ assigns(:manifestations).should_not be_nil
111
+ response.should render_template("manifestations/index")
112
+ end
113
+
114
+ it "should get index with manifestation_id" do
115
+ get :index, :manifestation_id => 1
116
+ response.should be_success
117
+ assigns(:manifestation).should eq Manifestation.find(1)
118
+ assigns(:manifestations).collect(&:id).should eq assigns(:manifestation).derived_manifestations.collect(&:id)
119
+ end
120
+
121
+ it "should get index with publisher_id" do
122
+ get :index, :publisher_id => 1
123
+ response.should be_success
124
+ assigns(:manifestations).collect(&:id).should eq Patron.find(1).manifestations.order('created_at DESC').collect(&:id)
125
+ end
126
+
127
+ it "should get index with query" do
128
+ get :index, :query => '2005'
129
+ response.should be_success
130
+ assigns(:manifestations).should_not be_blank
131
+ end
132
+
133
+ it "should get index with page number" do
134
+ get :index, :query => '2005', :number_of_pages_at_least => 1, :number_of_pages_at_most => 100
135
+ response.should be_success
136
+ assigns(:query).should eq '2005 number_of_pages_i:[1 TO 100]'
137
+ end
138
+
139
+ it "should get index with pub_date_from" do
140
+ get :index, :query => '2005', :pub_date_from => '2000'
141
+ response.should be_success
142
+ assigns(:manifestations).should be_true
143
+ assigns(:query).should eq '2005 date_of_publication_d:[1999-12-31T15:00:00Z TO *]'
144
+ end
145
+
146
+ it "should get index with pub_date_to" do
147
+ get :index, :query => '2005', :pub_date_to => '2000'
148
+ response.should be_success
149
+ assigns(:manifestations).should be_true
150
+ assigns(:query).should eq '2005 date_of_publication_d:[* TO 2000-12-31T14:59:59Z]'
151
+ end
152
+
153
+ it "should get index_all_facet" do
154
+ get :index, :query => '2005', :view => 'all_facet'
155
+ response.should be_success
156
+ assigns(:carrier_type_facet).should_not be_empty
157
+ assigns(:language_facet).should_not be_empty
158
+ assigns(:library_facet).should_not be_empty
159
+ end
160
+
161
+ it "should get index_carrier_type_facet" do
162
+ get :index, :query => '2005', :view => 'carrier_type_facet'
163
+ response.should be_success
164
+ assigns(:carrier_type_facet).should_not be_empty
165
+ end
166
+
167
+ it "should get index_language_facet" do
168
+ get :index, :query => '2005', :view => 'language_facet'
169
+ response.should be_success
170
+ assigns(:language_facet).should_not be_empty
171
+ end
172
+
173
+ it "should get index_library_facet" do
174
+ get :index, :query => '2005', :view => 'library_facet'
175
+ response.should be_success
176
+ assigns(:library_facet).should_not be_empty
177
+ end
178
+
179
+ it "should get index_pub_year_facet" do
180
+ get :index, :view => 'pub_year_facet'
181
+ response.should be_success
182
+ assigns(:pub_year_facet).first.value.should eq 2010.0..2020.0
183
+ assigns(:pub_year_facet).first.count.should eq 1
184
+ assigns(:pub_year_facet).last.value.should eq 2000.0..2010.0
185
+ assigns(:pub_year_facet).last.count.should eq 1
186
+ end
187
+ end
188
+ end
189
+
190
+ describe "GET show" do
191
+ describe "When logged in as Administrator" do
192
+ login_admin
193
+
194
+ it "assigns the requested manifestation as @manifestation" do
195
+ get :show, :id => 1
196
+ assigns(:manifestation).should eq(Manifestation.find(1))
197
+ end
198
+ end
199
+
200
+ describe "When logged in as Librarian" do
201
+ login_librarian
202
+
203
+ it "assigns the requested manifestation as @manifestation" do
204
+ get :show, :id => 1
205
+ assigns(:manifestation).should eq(Manifestation.find(1))
206
+ end
207
+
208
+ it "should show manifestation with patron who does not produce it" do
209
+ get :show, :id => 3, :patron_id => 3
210
+ assigns(:manifestation).should eq assigns(:patron).manifestations.find(3)
211
+ response.should be_success
212
+ end
213
+ end
214
+
215
+ describe "When logged in as User" do
216
+ login_fixture_user
217
+
218
+ it "assigns the requested manifestation as @manifestation" do
219
+ get :show, :id => 1
220
+ assigns(:manifestation).should eq(Manifestation.find(1))
221
+ end
222
+
223
+ it "should send manifestation detail email" do
224
+ get :show, :id => 1, :mode => 'send_email'
225
+ response.should redirect_to manifestation_url(assigns(:manifestation))
226
+ end
227
+
228
+ #it "should show myself" do
229
+ # get :show, :id => users(:user1).patron
230
+ # response.should be_success
231
+ #end
232
+ end
233
+
234
+ describe "When not logged in" do
235
+ it "assigns the requested manifestation as @manifestation" do
236
+ get :show, :id => 1
237
+ assigns(:manifestation).should eq(Manifestation.find(1))
238
+ end
239
+
240
+ it "guest should show manifestation mods template" do
241
+ get :show, :id => 22, :format => 'mods'
242
+ assigns(:manifestation).should eq Manifestation.find(22)
243
+ response.should render_template("manifestations/show")
244
+ end
245
+
246
+ it "should show manifestation rdf template" do
247
+ get :show, :id => 22, :format => 'rdf'
248
+ assigns(:manifestation).should eq Manifestation.find(22)
249
+ response.should render_template("manifestations/show")
250
+ end
251
+
252
+ it "should show_manifestation with isbn" do
253
+ get :show, :isbn => "4798002062"
254
+ response.should redirect_to manifestation_url(assigns(:manifestation))
255
+ end
256
+
257
+ it "should not show missing manifestation with isbn" do
258
+ get :show, :isbn => "47980020620"
259
+ response.should be_missing
260
+ end
261
+
262
+ it "should show manifestation with holding" do
263
+ get :show, :id => 1, :mode => 'holding'
264
+ response.should be_success
265
+ end
266
+
267
+ it "should show manifestation with show_creators" do
268
+ get :show, :id => 1, :mode => 'show_creators'
269
+ response.should render_template('manifestations/_show_creators')
270
+ response.should be_success
271
+ end
272
+
273
+ it "should show manifestation with show_all_creators" do
274
+ get :show, :id => 1, :mode => 'show_all_creators'
275
+ response.should render_template('manifestations/_show_creators')
276
+ response.should be_success
277
+ end
278
+
279
+ it "should not send manifestation's detail email" do
280
+ get :show, :id => 1, :mode => 'send_email'
281
+ response.should redirect_to new_user_session_url
282
+ end
283
+ end
284
+ end
285
+
286
+ describe "GET new" do
287
+ describe "When logged in as Administrator" do
288
+ login_admin
289
+
290
+ it "assigns the requested manifestation as @manifestation" do
291
+ get :new
292
+ assigns(:manifestation).should_not be_valid
293
+ end
294
+
295
+ it "should get new template without expression_id" do
296
+ get :new
297
+ response.should be_success
298
+ end
299
+
300
+ it "should get new template with expression_id" do
301
+ get :new, :expression_id => 1
302
+ response.should be_success
303
+ end
304
+ end
305
+
306
+ describe "When logged in as Librarian" do
307
+ login_librarian
308
+
309
+ it "assigns the requested manifestation as @manifestation" do
310
+ get :new
311
+ assigns(:manifestation).should_not be_valid
312
+ end
313
+
314
+ it "should get new template without expression_id" do
315
+ get :new
316
+ response.should be_success
317
+ end
318
+
319
+ it "should get new template with expression_id" do
320
+ get :new, :expression_id => 1
321
+ response.should be_success
322
+ end
323
+ end
324
+
325
+ describe "When logged in as User" do
326
+ login_user
327
+
328
+ it "should not assign the requested manifestation as @manifestation" do
329
+ get :new
330
+ assigns(:manifestation).should_not be_valid
331
+ response.should be_forbidden
332
+ end
333
+ end
334
+
335
+ describe "When not logged in" do
336
+ it "should not assign the requested manifestation as @manifestation" do
337
+ get :new
338
+ assigns(:manifestation).should_not be_valid
339
+ response.should redirect_to(new_user_session_url)
340
+ end
341
+ end
342
+ end
343
+
344
+ describe "GET edit" do
345
+ describe "When logged in as Administrator" do
346
+ login_admin
347
+
348
+ it "assigns the requested manifestation as @manifestation" do
349
+ manifestation = FactoryGirl.create(:manifestation)
350
+ get :edit, :id => manifestation.id
351
+ assigns(:manifestation).should eq(manifestation)
352
+ end
353
+ end
354
+
355
+ describe "When logged in as Librarian" do
356
+ login_librarian
357
+
358
+ it "assigns the requested manifestation as @manifestation" do
359
+ manifestation = FactoryGirl.create(:manifestation)
360
+ get :edit, :id => manifestation.id
361
+ assigns(:manifestation).should eq(manifestation)
362
+ end
363
+ end
364
+
365
+ describe "When logged in as User" do
366
+ login_user
367
+
368
+ it "assigns the requested manifestation as @manifestation" do
369
+ manifestation = FactoryGirl.create(:manifestation)
370
+ get :edit, :id => manifestation.id
371
+ response.should be_forbidden
372
+ end
373
+
374
+ it "should edit manifestation with tag_edit" do
375
+ get :edit, :id => 1, :mode => 'tag_edit'
376
+ response.should be_success
377
+ end
378
+ end
379
+
380
+ describe "When not logged in" do
381
+ it "should not assign the requested manifestation as @manifestation" do
382
+ manifestation = FactoryGirl.create(:manifestation)
383
+ get :edit, :id => manifestation.id
384
+ response.should redirect_to(new_user_session_url)
385
+ end
386
+ end
387
+ end
388
+
389
+ describe "POST create" do
390
+ before(:each) do
391
+ @attrs = valid_attributes
392
+ @invalid_attrs = {:original_title => ''}
393
+ end
394
+
395
+ describe "When logged in as Administrator" do
396
+ login_admin
397
+
398
+ describe "with valid params" do
399
+ it "assigns a newly created manifestation as @manifestation" do
400
+ post :create, :manifestation => @attrs
401
+ assigns(:manifestation).should be_valid
402
+ end
403
+
404
+ it "assigns a series_statement" do
405
+ post :create, :manifestation => @attrs.merge(:series_has_manifestation_attributes => {:series_statement_id => 1})
406
+ assigns(:manifestation).reload
407
+ assigns(:manifestation).series_statement.should eq SeriesStatement.find(1)
408
+ end
409
+
410
+ it "redirects to the created manifestation" do
411
+ post :create, :manifestation => @attrs
412
+ response.should redirect_to(manifestation_url(assigns(:manifestation)))
413
+ end
414
+ end
415
+
416
+ describe "with invalid params" do
417
+ it "assigns a newly created but unsaved manifestation as @manifestation" do
418
+ post :create, :manifestation => @invalid_attrs
419
+ assigns(:manifestation).should_not be_valid
420
+ end
421
+
422
+ it "re-renders the 'new' template" do
423
+ post :create, :manifestation => @invalid_attrs
424
+ response.should render_template("new")
425
+ end
426
+ end
427
+ end
428
+
429
+ describe "When logged in as Librarian" do
430
+ login_librarian
431
+
432
+ describe "with valid params" do
433
+ it "assigns a newly created manifestation as @manifestation" do
434
+ post :create, :manifestation => @attrs
435
+ assigns(:manifestation).should be_valid
436
+ end
437
+
438
+ it "redirects to the created manifestation" do
439
+ post :create, :manifestation => @attrs
440
+ response.should redirect_to(manifestation_url(assigns(:manifestation)))
441
+ end
442
+ end
443
+
444
+ describe "with invalid params" do
445
+ it "assigns a newly created but unsaved manifestation as @manifestation" do
446
+ post :create, :manifestation => @invalid_attrs
447
+ assigns(:manifestation).should_not be_valid
448
+ end
449
+
450
+ it "re-renders the 'new' template" do
451
+ post :create, :manifestation => @invalid_attrs
452
+ response.should render_template("new")
453
+ end
454
+ end
455
+ end
456
+
457
+ describe "When logged in as User" do
458
+ login_user
459
+
460
+ describe "with valid params" do
461
+ it "assigns a newly created manifestation as @manifestation" do
462
+ post :create, :manifestation => @attrs
463
+ assigns(:manifestation).should be_valid
464
+ end
465
+
466
+ it "should be forbidden" do
467
+ post :create, :manifestation => @attrs
468
+ response.should be_forbidden
469
+ end
470
+ end
471
+
472
+ describe "with invalid params" do
473
+ it "assigns a newly created but unsaved manifestation as @manifestation" do
474
+ post :create, :manifestation => @invalid_attrs
475
+ assigns(:manifestation).should_not be_valid
476
+ end
477
+
478
+ it "should be forbidden" do
479
+ post :create, :manifestation => @invalid_attrs
480
+ response.should be_forbidden
481
+ end
482
+ end
483
+ end
484
+
485
+ describe "When not logged in" do
486
+ describe "with valid params" do
487
+ it "assigns a newly created manifestation as @manifestation" do
488
+ post :create, :manifestation => @attrs
489
+ assigns(:manifestation).should be_valid
490
+ end
491
+
492
+ it "should be forbidden" do
493
+ post :create, :manifestation => @attrs
494
+ response.should redirect_to(new_user_session_url)
495
+ end
496
+ end
497
+
498
+ describe "with invalid params" do
499
+ it "assigns a newly created but unsaved manifestation as @manifestation" do
500
+ post :create, :manifestation => @invalid_attrs
501
+ assigns(:manifestation).should_not be_valid
502
+ end
503
+
504
+ it "should be forbidden" do
505
+ post :create, :manifestation => @invalid_attrs
506
+ response.should redirect_to(new_user_session_url)
507
+ end
508
+ end
509
+ end
510
+ end
511
+
512
+ describe "PUT update" do
513
+ before(:each) do
514
+ @manifestation = FactoryGirl.create(:manifestation)
515
+ @manifestation.series_statement = SeriesStatement.find(1)
516
+ @attrs = valid_attributes
517
+ @invalid_attrs = {:original_title => ''}
518
+ end
519
+
520
+ describe "When logged in as Administrator" do
521
+ login_admin
522
+
523
+ describe "with valid params" do
524
+ it "updates the requested manifestation" do
525
+ put :update, :id => @manifestation.id, :manifestation => @attrs
526
+ end
527
+
528
+ it "assigns a series_statement" do
529
+ put :update, :id => @manifestation.id, :manifestation => @attrs.merge(:series_has_manifestation_attributes => {:series_statement_id => 2})
530
+ assigns(:manifestation).reload
531
+ assigns(:manifestation).series_statement.should eq SeriesStatement.find(2)
532
+ end
533
+
534
+ it "assigns the requested manifestation as @manifestation" do
535
+ put :update, :id => @manifestation.id, :manifestation => @attrs
536
+ assigns(:manifestation).should eq(@manifestation)
537
+ end
538
+ end
539
+
540
+ describe "with invalid params" do
541
+ it "assigns the requested manifestation as @manifestation" do
542
+ put :update, :id => @manifestation.id, :manifestation => @invalid_attrs
543
+ response.should render_template("edit")
544
+ end
545
+ end
546
+ end
547
+
548
+ describe "When logged in as Librarian" do
549
+ login_librarian
550
+
551
+ describe "with valid params" do
552
+ it "updates the requested manifestation" do
553
+ put :update, :id => @manifestation.id, :manifestation => @attrs
554
+ end
555
+
556
+ it "assigns the requested manifestation as @manifestation" do
557
+ put :update, :id => @manifestation.id, :manifestation => @attrs
558
+ assigns(:manifestation).should eq(@manifestation)
559
+ response.should redirect_to(@manifestation)
560
+ end
561
+ end
562
+
563
+ describe "with invalid params" do
564
+ it "assigns the manifestation as @manifestation" do
565
+ put :update, :id => @manifestation, :manifestation => @invalid_attrs
566
+ assigns(:manifestation).should_not be_valid
567
+ end
568
+
569
+ it "re-renders the 'edit' template" do
570
+ put :update, :id => @manifestation, :manifestation => @invalid_attrs
571
+ response.should render_template("edit")
572
+ end
573
+ end
574
+ end
575
+
576
+ describe "When logged in as User" do
577
+ login_user
578
+
579
+ describe "with valid params" do
580
+ it "updates the requested manifestation" do
581
+ put :update, :id => @manifestation.id, :manifestation => @attrs
582
+ end
583
+
584
+ it "assigns the requested manifestation as @manifestation" do
585
+ put :update, :id => @manifestation.id, :manifestation => @attrs
586
+ assigns(:manifestation).should eq(@manifestation)
587
+ response.should be_forbidden
588
+ end
589
+ end
590
+
591
+ describe "with invalid params" do
592
+ it "assigns the requested manifestation as @manifestation" do
593
+ put :update, :id => @manifestation.id, :manifestation => @invalid_attrs
594
+ response.should be_forbidden
595
+ end
596
+ end
597
+ end
598
+
599
+ describe "When not logged in" do
600
+ describe "with valid params" do
601
+ it "updates the requested manifestation" do
602
+ put :update, :id => @manifestation.id, :manifestation => @attrs
603
+ end
604
+
605
+ it "should be forbidden" do
606
+ put :update, :id => @manifestation.id, :manifestation => @attrs
607
+ response.should redirect_to(new_user_session_url)
608
+ end
609
+ end
610
+
611
+ describe "with invalid params" do
612
+ it "assigns the requested manifestation as @manifestation" do
613
+ put :update, :id => @manifestation.id, :manifestation => @invalid_attrs
614
+ response.should redirect_to(new_user_session_url)
615
+ end
616
+ end
617
+ end
618
+ end
619
+
620
+ describe "DELETE destroy" do
621
+ before(:each) do
622
+ @manifestation = FactoryGirl.create(:manifestation)
623
+ end
624
+
625
+ describe "When logged in as Administrator" do
626
+ login_admin
627
+
628
+ it "destroys the requested manifestation" do
629
+ delete :destroy, :id => @manifestation.id
630
+ end
631
+
632
+ it "redirects to the manifestations list" do
633
+ delete :destroy, :id => @manifestation.id
634
+ response.should redirect_to(manifestations_url)
635
+ end
636
+
637
+ it "should not destroy the reserved manifestation" do
638
+ delete :destroy, :id => 2
639
+ response.should be_forbidden
640
+ end
641
+
642
+ it "should not destroy manifestation contains items" do
643
+ delete :destroy, :id => 1
644
+ response.should be_forbidden
645
+ end
646
+ end
647
+
648
+ describe "When logged in as Librarian" do
649
+ login_librarian
650
+
651
+ it "destroys the requested manifestation" do
652
+ delete :destroy, :id => @manifestation.id
653
+ end
654
+
655
+ it "should be forbidden" do
656
+ delete :destroy, :id => @manifestation.id
657
+ response.should redirect_to(manifestations_url)
658
+ end
659
+ end
660
+
661
+ describe "When logged in as User" do
662
+ login_user
663
+
664
+ it "destroys the requested manifestation" do
665
+ delete :destroy, :id => @manifestation.id
666
+ end
667
+
668
+ it "should be forbidden" do
669
+ delete :destroy, :id => @manifestation.id
670
+ response.should be_forbidden
671
+ end
672
+ end
673
+
674
+ describe "When not logged in" do
675
+ it "destroys the requested manifestation" do
676
+ delete :destroy, :id => @manifestation.id
677
+ end
678
+
679
+ it "should be forbidden" do
680
+ delete :destroy, :id => @manifestation.id
681
+ response.should redirect_to(new_user_session_url)
682
+ end
683
+ end
684
+ end
685
+ end