enju_biblio 0.1.0.pre42 → 0.1.0.pre43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (319) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/creates_controller.rb +11 -11
  3. data/app/controllers/items_controller.rb +3 -3
  4. data/app/controllers/manifestations_controller.rb +14 -14
  5. data/app/controllers/owns_controller.rb +10 -10
  6. data/app/controllers/patron_import_files_controller.rb +34 -34
  7. data/app/controllers/patron_import_results_controller.rb +5 -5
  8. data/app/controllers/patron_relationship_types_controller.rb +3 -3
  9. data/app/controllers/patron_relationships_controller.rb +7 -7
  10. data/app/controllers/patron_types_controller.rb +3 -3
  11. data/app/controllers/patrons_controller.rb +61 -61
  12. data/app/controllers/picture_files_controller.rb +4 -4
  13. data/app/controllers/produces_controller.rb +11 -11
  14. data/app/controllers/realizes_controller.rb +11 -11
  15. data/app/helpers/{patrons_helper.rb → agents_helper.rb} +5 -5
  16. data/app/models/{patron.rb → agent.rb} +36 -36
  17. data/app/models/{patron_import_file.rb → agent_import_file.rb} +77 -77
  18. data/app/models/agent_import_result.rb +26 -0
  19. data/app/models/{patron_relationship.rb → agent_relationship.rb} +7 -7
  20. data/app/models/{patron_relationship_type.rb → agent_relationship_type.rb} +4 -4
  21. data/app/models/{patron_sweeper.rb → agent_sweeper.rb} +6 -6
  22. data/app/models/{patron_type.rb → agent_type.rb} +4 -4
  23. data/app/models/country.rb +1 -1
  24. data/app/models/create.rb +7 -7
  25. data/app/models/donate.rb +5 -5
  26. data/app/models/enju_biblio/ability.rb +24 -24
  27. data/app/models/item.rb +5 -5
  28. data/app/models/item_sweeper.rb +2 -2
  29. data/app/models/manifestation.rb +24 -20
  30. data/app/models/own.rb +7 -7
  31. data/app/models/page_sweeper.rb +4 -4
  32. data/app/models/picture_file.rb +1 -1
  33. data/app/models/produce.rb +7 -7
  34. data/app/models/realize.rb +7 -7
  35. data/app/models/resource_import_file.rb +19 -19
  36. data/app/views/{patron_import_files → agent_import_files}/edit.html.erb +6 -6
  37. data/app/views/agent_import_files/index.html.erb +40 -0
  38. data/app/views/{patron_import_files → agent_import_files}/new.html.erb +3 -3
  39. data/app/views/agent_import_files/show.html.erb +69 -0
  40. data/app/views/agent_import_results/index.csv.erb +3 -0
  41. data/app/views/agent_import_results/index.html.erb +52 -0
  42. data/app/views/agent_import_results/show.html.erb +38 -0
  43. data/app/views/{patron_relationship_types → agent_relationship_types}/_form.html.erb +1 -1
  44. data/app/views/{patron_relationship_types → agent_relationship_types}/edit.html.erb +3 -3
  45. data/app/views/agent_relationship_types/index.html.erb +43 -0
  46. data/app/views/{patron_relationship_types → agent_relationship_types}/new.html.erb +2 -2
  47. data/app/views/agent_relationship_types/show.html.erb +29 -0
  48. data/app/views/{patron_relationships → agent_relationships}/_form.html.erb +7 -7
  49. data/app/views/{patron_relationships → agent_relationships}/edit.html.erb +3 -3
  50. data/app/views/agent_relationships/index.html.erb +34 -0
  51. data/app/views/{patron_relationships → agent_relationships}/new.html.erb +2 -2
  52. data/app/views/agent_relationships/show.html.erb +24 -0
  53. data/app/views/{patron_types → agent_types}/_form.html.erb +1 -1
  54. data/app/views/{patron_types → agent_types}/edit.html.erb +3 -3
  55. data/app/views/agent_types/index.html.erb +43 -0
  56. data/app/views/{patron_types → agent_types}/new.html.erb +2 -2
  57. data/app/views/agent_types/show.html.erb +29 -0
  58. data/app/views/{patrons → agents}/_expression_list.html.erb +3 -3
  59. data/app/views/{patrons → agents}/_form.html.erb +9 -9
  60. data/app/views/{patrons → agents}/_form_family_name_first.html.erb +0 -0
  61. data/app/views/{patrons → agents}/_form_family_name_last.html.erb +0 -0
  62. data/app/views/{patrons → agents}/_history_list.html.erb +2 -2
  63. data/app/views/{patrons → agents}/_index.html.erb +9 -9
  64. data/app/views/{patrons → agents}/_index_expression.html.erb +15 -15
  65. data/app/views/{patrons → agents}/_index_manifestation.html.erb +16 -16
  66. data/app/views/agents/_index_patron.html.erb +71 -0
  67. data/app/views/agents/_index_patron_merge_list.html.erb +53 -0
  68. data/app/views/{patrons → agents}/_index_work.html.erb +17 -17
  69. data/app/views/{patrons → agents}/_manifestation_list.html.erb +3 -3
  70. data/app/views/agents/_patron.html.erb +13 -0
  71. data/app/views/agents/_patron_list.html.erb +18 -0
  72. data/app/views/{patrons → agents}/_work_list.html.erb +1 -1
  73. data/app/views/agents/edit.html.erb +16 -0
  74. data/app/views/agents/index.atom.builder +10 -0
  75. data/app/views/{patrons → agents}/index.html.erb +4 -4
  76. data/app/views/{patrons → agents}/index.mobile.erb +5 -5
  77. data/app/views/{patrons → agents}/index.rss.builder +11 -11
  78. data/app/views/{patrons → agents}/new.html.erb +2 -2
  79. data/app/views/agents/show.html.erb +152 -0
  80. data/app/views/{patrons → agents}/show.js.erb +0 -0
  81. data/app/views/agents/show.mobile.erb +69 -0
  82. data/app/views/creates/_form.html.erb +5 -5
  83. data/app/views/creates/_index.html.erb +2 -2
  84. data/app/views/creates/_index_patron.html.erb +6 -6
  85. data/app/views/creates/_index_work.html.erb +2 -2
  86. data/app/views/creates/index.html.erb +2 -2
  87. data/app/views/creates/new.html.erb +3 -3
  88. data/app/views/creates/show.html.erb +4 -4
  89. data/app/views/donates/edit.html.erb +2 -2
  90. data/app/views/donates/index.html.erb +2 -2
  91. data/app/views/donates/new.html.erb +2 -2
  92. data/app/views/donates/show.html.erb +2 -2
  93. data/app/views/items/index.html.erb +1 -1
  94. data/app/views/languages/index.html.erb +1 -1
  95. data/app/views/layouts/patrons.html.erb +2 -2
  96. data/app/views/manifestations/_index_form_contributor.html.erb +1 -1
  97. data/app/views/manifestations/_index_form_creator.html.erb +1 -1
  98. data/app/views/manifestations/_index_form_publisher.html.erb +1 -1
  99. data/app/views/manifestations/_manifestation_list.html.erb +6 -6
  100. data/app/views/manifestations/_show.mods.builder +4 -4
  101. data/app/views/manifestations/_show.rdf.builder +4 -4
  102. data/app/views/manifestations/_show_creators.html.erb +4 -4
  103. data/app/views/manifestations/_show_creators.mobile.erb +4 -4
  104. data/app/views/manifestations/_title.html.erb +3 -3
  105. data/app/views/manifestations/_title.mobile.erb +3 -3
  106. data/app/views/manifestations/edit.html.erb +2 -2
  107. data/app/views/manifestations/index.atom.builder +2 -2
  108. data/app/views/manifestations/index.html.erb +3 -3
  109. data/app/views/manifestations/index.opds.builder +2 -2
  110. data/app/views/manifestations/index.sru.builder +6 -6
  111. data/app/views/manifestations/new.html.erb +2 -2
  112. data/app/views/notifier/manifestation_info.en.text.erb +1 -1
  113. data/app/views/notifier/manifestation_info.ja.text.erb +1 -1
  114. data/app/views/owns/_form.html.erb +1 -1
  115. data/app/views/owns/index.html.erb +2 -2
  116. data/app/views/owns/show.html.erb +4 -4
  117. data/app/views/picture_files/_index.html.erb +1 -1
  118. data/app/views/picture_files/_index_patron.html.erb +2 -2
  119. data/app/views/picture_files/index.html.erb +2 -2
  120. data/app/views/picture_files/show.html.erb +2 -2
  121. data/app/views/produces/_form.html.erb +5 -5
  122. data/app/views/produces/_index.html.erb +2 -2
  123. data/app/views/produces/_index_manifestation.html.erb +3 -3
  124. data/app/views/produces/_index_patron.html.erb +3 -3
  125. data/app/views/produces/index.html.erb +2 -2
  126. data/app/views/produces/new.html.erb +3 -3
  127. data/app/views/produces/show.html.erb +4 -4
  128. data/app/views/realizes/_form.html.erb +5 -5
  129. data/app/views/realizes/_index.html.erb +2 -2
  130. data/app/views/realizes/_index_expression.html.erb +3 -3
  131. data/app/views/realizes/_index_patron.html.erb +3 -3
  132. data/app/views/realizes/index.html.erb +2 -2
  133. data/app/views/realizes/new.html.erb +3 -3
  134. data/app/views/realizes/show.html.erb +4 -4
  135. data/app/views/resource_import_results/show.html.erb +1 -1
  136. data/config/routes.rb +16 -16
  137. data/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +8 -8
  138. data/db/migrate/012_create_owns.rb +2 -2
  139. data/db/migrate/015_create_creates.rb +2 -2
  140. data/db/migrate/047_create_produces.rb +2 -2
  141. data/db/migrate/125_create_donates.rb +2 -2
  142. data/db/migrate/20080830154109_create_realizes.rb +2 -2
  143. data/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +2 -2
  144. data/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
  145. data/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +2 -2
  146. data/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
  147. data/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
  148. data/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
  149. data/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
  150. data/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
  151. data/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
  152. data/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +5 -0
  153. data/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +6 -0
  154. data/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +5 -0
  155. data/lib/enju_biblio/biblio_helper.rb +8 -8
  156. data/lib/enju_biblio/version.rb +1 -1
  157. data/lib/enju_biblio.rb +3 -3
  158. data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_relationship_types.yml +3 -3
  159. data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_types.yml +2 -2
  160. data/lib/generators/enju_biblio/setup/templates/db/fixtures/patrons.yml +4 -4
  161. data/spec/controllers/agent_import_files_controller_spec.rb +321 -0
  162. data/spec/controllers/{patron_import_results_controller_spec.rb → agent_import_results_controller_spec.rb} +17 -17
  163. data/spec/controllers/agent_relationship_types_controller_spec.rb +445 -0
  164. data/spec/controllers/agent_relationships_controller_spec.rb +446 -0
  165. data/spec/controllers/agent_types_controller_spec.rb +447 -0
  166. data/spec/controllers/agents_controller_spec.rb +644 -0
  167. data/spec/controllers/countries_controller_spec.rb +1 -1
  168. data/spec/controllers/items_controller_spec.rb +4 -4
  169. data/spec/controllers/manifestation_relationship_types_controller_spec.rb +1 -1
  170. data/spec/controllers/manifestations_controller_spec.rb +4 -4
  171. data/spec/controllers/owns_controller_spec.rb +2 -2
  172. data/spec/controllers/resource_import_files_controller_spec.rb +1 -1
  173. data/spec/dummy/app/helpers/application_helper.rb +5 -222
  174. data/spec/dummy/app/models/ability.rb +31 -31
  175. data/spec/dummy/app/models/{local_patron.rb → local_agent.rb} +1 -1
  176. data/spec/dummy/app/models/user.rb +3 -3
  177. data/spec/dummy/config/application.rb +0 -1
  178. data/spec/dummy/config/environments/test.rb +1 -0
  179. data/spec/dummy/db/development.sqlite3 +0 -0
  180. data/spec/dummy/db/migrate/035_create_reserves.rb +1 -1
  181. data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -2
  182. data/spec/dummy/db/schema.rb +132 -132
  183. data/spec/dummy/db/test.sqlite3 +0 -0
  184. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_delete_file.tsv +8 -0
  185. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample1.tsv +5 -0
  186. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample2.tsv +8 -0
  187. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample3.tsv +5 -0
  188. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_update_file.tsv +3 -0
  189. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  190. data/spec/dummy/solr/data/test/index/segments_q76 +0 -0
  191. data/spec/factories/{patron.rb → agent.rb} +3 -3
  192. data/spec/factories/create.rb +1 -1
  193. data/spec/factories/donate.rb +1 -1
  194. data/spec/factories/own.rb +1 -1
  195. data/spec/factories/patron_relationship.rb +3 -3
  196. data/spec/factories/patron_relationship_type.rb +2 -2
  197. data/spec/factories/patron_type.rb +2 -2
  198. data/spec/factories/produce.rb +1 -1
  199. data/spec/factories/realize.rb +1 -1
  200. data/spec/fixtures/{patron_import_files.yml → agent_import_files.yml} +18 -18
  201. data/spec/fixtures/{patron_import_results.yml → agent_import_results.yml} +7 -7
  202. data/spec/fixtures/{patron_relationship_types.yml → agent_relationship_types.yml} +4 -4
  203. data/spec/fixtures/{patron_relationships.yml → agent_relationships.yml} +4 -4
  204. data/spec/fixtures/{patron_types.yml → agent_types.yml} +4 -4
  205. data/spec/fixtures/{patrons.yml → agents.yml} +47 -47
  206. data/spec/fixtures/creates.yml +8 -8
  207. data/spec/fixtures/donates.yml +4 -4
  208. data/spec/fixtures/owns.yml +3 -3
  209. data/spec/fixtures/picture_files.yml +1 -1
  210. data/spec/fixtures/produces.yml +20 -20
  211. data/spec/fixtures/realizes.yml +11 -11
  212. data/spec/fixtures/reserves.yml +1 -1
  213. data/spec/models/agent_import_file_spec.rb +96 -0
  214. data/spec/models/{patron_import_result_spec.rb → agent_import_result_spec.rb} +4 -4
  215. data/spec/models/{patron_relationship_spec.rb → agent_relationship_spec.rb} +3 -3
  216. data/spec/models/{patron_relationship_type_spec.rb → agent_relationship_type_spec.rb} +2 -2
  217. data/spec/models/{patron_spec.rb → agent_spec.rb} +16 -16
  218. data/spec/models/{patron_type_spec.rb → agent_type_spec.rb} +2 -2
  219. data/spec/models/create_spec.rb +1 -1
  220. data/spec/models/donate_spec.rb +1 -1
  221. data/spec/models/manifestation_spec.rb +1 -1
  222. data/spec/models/own_spec.rb +1 -1
  223. data/spec/models/produce_spec.rb +1 -1
  224. data/spec/models/realize_spec.rb +1 -1
  225. data/spec/models/resource_import_file_spec.rb +8 -8
  226. data/spec/requests/agents_spec.rb +9 -0
  227. data/spec/routing/agent_relationship_types_routing_spec.rb +35 -0
  228. data/spec/routing/agent_relationships_routing_spec.rb +35 -0
  229. data/spec/routing/agents_routing_spec.rb +35 -0
  230. data/spec/views/creates/edit.html.erb_spec.rb +1 -1
  231. data/spec/views/creates/index.html.erb_spec.rb +2 -2
  232. data/spec/views/creates/new.html.erb_spec.rb +1 -1
  233. data/spec/views/creates/show.html.erb_spec.rb +1 -1
  234. data/spec/views/owns/edit.html.erb_spec.rb +1 -1
  235. data/spec/views/owns/index.html.erb_spec.rb +2 -2
  236. data/spec/views/owns/new.html.erb_spec.rb +1 -1
  237. data/spec/views/owns/show.html.erb_spec.rb +1 -1
  238. data/spec/views/produces/edit.html.erb_spec.rb +2 -2
  239. data/spec/views/produces/index.html.erb_spec.rb +2 -2
  240. data/spec/views/produces/new.html.erb_spec.rb +2 -2
  241. data/spec/views/produces/show.html.erb_spec.rb +1 -1
  242. data/spec/views/realizes/edit.html.erb_spec.rb +2 -2
  243. data/spec/views/realizes/index.html.erb_spec.rb +2 -2
  244. data/spec/views/realizes/new.html.erb_spec.rb +2 -2
  245. data/spec/views/realizes/show.html.erb_spec.rb +1 -1
  246. metadata +131 -187
  247. data/app/models/patron_import_result.rb +0 -26
  248. data/app/views/patron_import_files/index.html.erb +0 -40
  249. data/app/views/patron_import_files/show.html.erb +0 -69
  250. data/app/views/patron_import_results/index.csv.erb +0 -3
  251. data/app/views/patron_import_results/index.html.erb +0 -52
  252. data/app/views/patron_import_results/show.html.erb +0 -38
  253. data/app/views/patron_relationship_types/index.html.erb +0 -43
  254. data/app/views/patron_relationship_types/show.html.erb +0 -29
  255. data/app/views/patron_relationships/index.html.erb +0 -34
  256. data/app/views/patron_relationships/show.html.erb +0 -24
  257. data/app/views/patron_types/index.html.erb +0 -43
  258. data/app/views/patron_types/show.html.erb +0 -29
  259. data/app/views/patrons/_index_patron.html.erb +0 -71
  260. data/app/views/patrons/_index_patron_merge_list.html.erb +0 -53
  261. data/app/views/patrons/_patron.html.erb +0 -13
  262. data/app/views/patrons/_patron_list.html.erb +0 -18
  263. data/app/views/patrons/edit.html.erb +0 -16
  264. data/app/views/patrons/index.atom.builder +0 -10
  265. data/app/views/patrons/show.html.erb +0 -152
  266. data/app/views/patrons/show.mobile.erb +0 -69
  267. data/db/migrate/20081028083142_create_patron_import_files.rb +0 -22
  268. data/db/migrate/20100606073747_create_patron_relationships.rb +0 -13
  269. data/db/migrate/20100814091104_add_position_to_patron_relationship.rb +0 -11
  270. data/db/migrate/20100925074559_create_patron_import_results.rb +0 -12
  271. data/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +0 -11
  272. data/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +0 -5
  273. data/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +0 -5
  274. data/db/migrate/20120511072422_add_patron_identifier_to_patron.rb +0 -6
  275. data/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +0 -5
  276. data/spec/controllers/patron_import_files_controller_spec.rb +0 -321
  277. data/spec/controllers/patron_relationship_types_controller_spec.rb +0 -445
  278. data/spec/controllers/patron_relationships_controller_spec.rb +0 -446
  279. data/spec/controllers/patron_types_controller_spec.rb +0 -447
  280. data/spec/controllers/patrons_controller_spec.rb +0 -644
  281. data/spec/dummy/app/mailers/notifier.rb +0 -40
  282. data/spec/dummy/lib/plugins/ext/event-calendar.rb +0 -38
  283. data/spec/dummy/lib/plugins/ext/sunspot/abstract_search.rb +0 -12
  284. data/spec/dummy/lib/plugins/ext/sunspot/dismax.rb +0 -41
  285. data/spec/dummy/lib/plugins/ext/sunspot/start_record.rb +0 -55
  286. data/spec/dummy/lib/plugins/ext/sunspot.rb +0 -3
  287. data/spec/dummy/lib/plugins/ext.rb +0 -1
  288. data/spec/dummy/lib/plugins.rb +0 -2
  289. data/spec/dummy/solr/data/test/index/_goc.fdt +0 -0
  290. data/spec/dummy/solr/data/test/index/_goc.fdx +0 -0
  291. data/spec/dummy/solr/data/test/index/_goc.fnm +0 -7
  292. data/spec/dummy/solr/data/test/index/_goc.frq +0 -0
  293. data/spec/dummy/solr/data/test/index/_goc.nrm +0 -1
  294. data/spec/dummy/solr/data/test/index/_goc.prx +0 -0
  295. data/spec/dummy/solr/data/test/index/_goc.tii +0 -0
  296. data/spec/dummy/solr/data/test/index/_goc.tis +0 -0
  297. data/spec/dummy/solr/data/test/index/_god.fdt +0 -0
  298. data/spec/dummy/solr/data/test/index/_god.fdx +0 -0
  299. data/spec/dummy/solr/data/test/index/_god.fnm +0 -7
  300. data/spec/dummy/solr/data/test/index/_god.frq +0 -0
  301. data/spec/dummy/solr/data/test/index/_god.nrm +0 -1
  302. data/spec/dummy/solr/data/test/index/_god.prx +0 -0
  303. data/spec/dummy/solr/data/test/index/_god.tii +0 -0
  304. data/spec/dummy/solr/data/test/index/_god.tis +0 -0
  305. data/spec/dummy/solr/data/test/index/_goe.fdt +0 -0
  306. data/spec/dummy/solr/data/test/index/_goe.fdx +0 -0
  307. data/spec/dummy/solr/data/test/index/_goe.fnm +0 -8
  308. data/spec/dummy/solr/data/test/index/_goe.frq +0 -0
  309. data/spec/dummy/solr/data/test/index/_goe.nrm +0 -1
  310. data/spec/dummy/solr/data/test/index/_goe.prx +0 -0
  311. data/spec/dummy/solr/data/test/index/_goe.tii +0 -0
  312. data/spec/dummy/solr/data/test/index/_goe.tis +0 -0
  313. data/spec/dummy/solr/data/test/index/segments_otc +0 -0
  314. data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
  315. data/spec/models/patron_import_file_spec.rb +0 -96
  316. data/spec/requests/patrons_spec.rb +0 -9
  317. data/spec/routing/patron_relationship_types_routing_spec.rb +0 -35
  318. data/spec/routing/patron_relationships_routing_spec.rb +0 -35
  319. data/spec/routing/patrons_routing_spec.rb +0 -35
@@ -1,446 +0,0 @@
1
- require 'spec_helper'
2
- require 'sunspot/rails/spec_helper'
3
-
4
- describe PatronRelationshipsController do
5
- fixtures :all
6
- disconnect_sunspot
7
-
8
- def valid_attributes
9
- @attrs = FactoryGirl.attributes_for(:patron_relationship)
10
- end
11
-
12
- describe "GET index" do
13
- before(:each) do
14
- FactoryGirl.create(:patron_relationship)
15
- end
16
-
17
- describe "When logged in as Administrator" do
18
- login_admin
19
-
20
- it "assigns all patron_relationships as @patron_relationships" do
21
- get :index
22
- assigns(:patron_relationships).should eq(PatronRelationship.all)
23
- end
24
- end
25
-
26
- describe "When logged in as Librarian" do
27
- login_librarian
28
-
29
- it "assigns all patron_relationships as @patron_relationships" do
30
- get :index
31
- assigns(:patron_relationships).should eq(PatronRelationship.all)
32
- end
33
- end
34
-
35
- describe "When logged in as User" do
36
- login_user
37
-
38
- it "assigns all patron_relationships as @patron_relationships" do
39
- get :index
40
- assigns(:patron_relationships).should eq(PatronRelationship.all)
41
- end
42
- end
43
-
44
- describe "When not logged in" do
45
- it "assigns all patron_relationships as @patron_relationships" do
46
- get :index
47
- assigns(:patron_relationships).should eq(PatronRelationship.all)
48
- end
49
- end
50
- end
51
-
52
- describe "GET show" do
53
- describe "When logged in as Administrator" do
54
- login_admin
55
-
56
- it "assigns the requested patron_relationship as @patron_relationship" do
57
- patron_relationship = FactoryGirl.create(:patron_relationship)
58
- get :show, :id => patron_relationship.id
59
- assigns(:patron_relationship).should eq(patron_relationship)
60
- end
61
- end
62
-
63
- describe "When logged in as Librarian" do
64
- login_librarian
65
-
66
- it "assigns the requested patron_relationship as @patron_relationship" do
67
- patron_relationship = FactoryGirl.create(:patron_relationship)
68
- get :show, :id => patron_relationship.id
69
- assigns(:patron_relationship).should eq(patron_relationship)
70
- end
71
- end
72
-
73
- describe "When logged in as User" do
74
- login_user
75
-
76
- it "assigns the requested patron_relationship as @patron_relationship" do
77
- patron_relationship = FactoryGirl.create(:patron_relationship)
78
- get :show, :id => patron_relationship.id
79
- assigns(:patron_relationship).should eq(patron_relationship)
80
- end
81
- end
82
-
83
- describe "When not logged in" do
84
- it "assigns the requested patron_relationship as @patron_relationship" do
85
- patron_relationship = FactoryGirl.create(:patron_relationship)
86
- get :show, :id => patron_relationship.id
87
- assigns(:patron_relationship).should eq(patron_relationship)
88
- end
89
- end
90
- end
91
-
92
- describe "GET new" do
93
- describe "When logged in as Administrator" do
94
- login_admin
95
-
96
- it "assigns the requested patron_relationship as @patron_relationship" do
97
- get :new
98
- assigns(:patron_relationship).should_not be_valid
99
- response.should be_success
100
- end
101
- end
102
-
103
- describe "When logged in as Librarian" do
104
- login_librarian
105
-
106
- it "should not assign the requested patron_relationship as @patron_relationship" do
107
- get :new
108
- assigns(:patron_relationship).should_not be_valid
109
- response.should be_success
110
- end
111
- end
112
-
113
- describe "When logged in as User" do
114
- login_user
115
-
116
- it "should not assign the requested patron_relationship as @patron_relationship" do
117
- get :new
118
- assigns(:patron_relationship).should_not be_valid
119
- response.should be_forbidden
120
- end
121
- end
122
-
123
- describe "When not logged in" do
124
- it "should not assign the requested patron_relationship as @patron_relationship" do
125
- get :new
126
- assigns(:patron_relationship).should_not be_valid
127
- response.should redirect_to(new_user_session_url)
128
- end
129
- end
130
- end
131
-
132
- describe "GET edit" do
133
- describe "When logged in as Administrator" do
134
- login_admin
135
-
136
- it "assigns the requested patron_relationship as @patron_relationship" do
137
- patron_relationship = FactoryGirl.create(:patron_relationship)
138
- get :edit, :id => patron_relationship.id
139
- assigns(:patron_relationship).should eq(patron_relationship)
140
- end
141
- end
142
-
143
- describe "When logged in as Librarian" do
144
- login_librarian
145
-
146
- it "assigns the requested patron_relationship as @patron_relationship" do
147
- patron_relationship = FactoryGirl.create(:patron_relationship)
148
- get :edit, :id => patron_relationship.id
149
- assigns(:patron_relationship).should eq(patron_relationship)
150
- end
151
- end
152
-
153
- describe "When logged in as User" do
154
- login_user
155
-
156
- it "assigns the requested patron_relationship as @patron_relationship" do
157
- patron_relationship = FactoryGirl.create(:patron_relationship)
158
- get :edit, :id => patron_relationship.id
159
- response.should be_forbidden
160
- end
161
- end
162
-
163
- describe "When not logged in" do
164
- it "should not assign the requested patron_relationship as @patron_relationship" do
165
- patron_relationship = FactoryGirl.create(:patron_relationship)
166
- get :edit, :id => patron_relationship.id
167
- response.should redirect_to(new_user_session_url)
168
- end
169
- end
170
- end
171
-
172
- describe "POST create" do
173
- before(:each) do
174
- @attrs = valid_attributes
175
- @invalid_attrs = {:parent_id => ''}
176
- end
177
-
178
- describe "When logged in as Administrator" do
179
- login_admin
180
-
181
- describe "with valid params" do
182
- it "assigns a newly created patron_relationship as @patron_relationship" do
183
- post :create, :patron_relationship => @attrs
184
- assigns(:patron_relationship).should be_valid
185
- end
186
-
187
- it "redirects to the created patron" do
188
- post :create, :patron_relationship => @attrs
189
- response.should redirect_to(assigns(:patron_relationship))
190
- end
191
- end
192
-
193
- describe "with invalid params" do
194
- it "assigns a newly created but unsaved patron_relationship as @patron_relationship" do
195
- post :create, :patron_relationship => @invalid_attrs
196
- assigns(:patron_relationship).should_not be_valid
197
- end
198
-
199
- it "re-renders the 'new' template" do
200
- post :create, :patron_relationship => @invalid_attrs
201
- response.should render_template("new")
202
- end
203
- end
204
- end
205
-
206
- describe "When logged in as Librarian" do
207
- login_librarian
208
-
209
- describe "with valid params" do
210
- it "assigns a newly created patron_relationship as @patron_relationship" do
211
- post :create, :patron_relationship => @attrs
212
- assigns(:patron_relationship).should be_valid
213
- end
214
-
215
- it "redirects to the created patron" do
216
- post :create, :patron_relationship => @attrs
217
- response.should redirect_to(assigns(:patron_relationship))
218
- end
219
- end
220
-
221
- describe "with invalid params" do
222
- it "assigns a newly created but unsaved patron_relationship as @patron_relationship" do
223
- post :create, :patron_relationship => @invalid_attrs
224
- assigns(:patron_relationship).should_not be_valid
225
- end
226
-
227
- it "re-renders the 'new' template" do
228
- post :create, :patron_relationship => @invalid_attrs
229
- response.should render_template("new")
230
- end
231
- end
232
- end
233
-
234
- describe "When logged in as User" do
235
- login_user
236
-
237
- describe "with valid params" do
238
- it "assigns a newly created patron_relationship as @patron_relationship" do
239
- post :create, :patron_relationship => @attrs
240
- assigns(:patron_relationship).should be_valid
241
- end
242
-
243
- it "should be forbidden" do
244
- post :create, :patron_relationship => @attrs
245
- response.should be_forbidden
246
- end
247
- end
248
-
249
- describe "with invalid params" do
250
- it "assigns a newly created but unsaved patron_relationship as @patron_relationship" do
251
- post :create, :patron_relationship => @invalid_attrs
252
- assigns(:patron_relationship).should_not be_valid
253
- end
254
-
255
- it "should be forbidden" do
256
- post :create, :patron_relationship => @invalid_attrs
257
- response.should be_forbidden
258
- end
259
- end
260
- end
261
-
262
- describe "When not logged in" do
263
- describe "with valid params" do
264
- it "assigns a newly created patron_relationship as @patron_relationship" do
265
- post :create, :patron_relationship => @attrs
266
- assigns(:patron_relationship).should be_valid
267
- end
268
-
269
- it "should be forbidden" do
270
- post :create, :patron_relationship => @attrs
271
- response.should redirect_to(new_user_session_url)
272
- end
273
- end
274
-
275
- describe "with invalid params" do
276
- it "assigns a newly created but unsaved patron_relationship as @patron_relationship" do
277
- post :create, :patron_relationship => @invalid_attrs
278
- assigns(:patron_relationship).should_not be_valid
279
- end
280
-
281
- it "should be forbidden" do
282
- post :create, :patron_relationship => @invalid_attrs
283
- response.should redirect_to(new_user_session_url)
284
- end
285
- end
286
- end
287
- end
288
-
289
- describe "PUT update" do
290
- before(:each) do
291
- @patron_relationship = FactoryGirl.create(:patron_relationship)
292
- @attrs = valid_attributes
293
- @invalid_attrs = {:parent_id => ''}
294
- end
295
-
296
- describe "When logged in as Administrator" do
297
- login_admin
298
-
299
- describe "with valid params" do
300
- it "updates the requested patron_relationship" do
301
- put :update, :id => @patron_relationship.id, :patron_relationship => @attrs
302
- end
303
-
304
- it "assigns the requested patron_relationship as @patron_relationship" do
305
- put :update, :id => @patron_relationship.id, :patron_relationship => @attrs
306
- assigns(:patron_relationship).should eq(@patron_relationship)
307
- response.should redirect_to(@patron_relationship)
308
- end
309
-
310
- it "moves its position when specified" do
311
- put :update, :id => @patron_relationship.id, :patron_relationship => @attrs, :move => 'lower'
312
- response.should redirect_to(patron_relationships_url)
313
- end
314
- end
315
-
316
- describe "with invalid params" do
317
- it "assigns the requested patron_relationship as @patron_relationship" do
318
- put :update, :id => @patron_relationship.id, :patron_relationship => @invalid_attrs
319
- response.should render_template("edit")
320
- end
321
- end
322
- end
323
-
324
- describe "When logged in as Librarian" do
325
- login_librarian
326
-
327
- describe "with valid params" do
328
- it "updates the requested patron_relationship" do
329
- put :update, :id => @patron_relationship.id, :patron_relationship => @attrs
330
- end
331
-
332
- it "assigns the requested patron_relationship as @patron_relationship" do
333
- put :update, :id => @patron_relationship.id, :patron_relationship => @attrs
334
- assigns(:patron_relationship).should eq(@patron_relationship)
335
- response.should redirect_to(@patron_relationship)
336
- end
337
- end
338
-
339
- describe "with invalid params" do
340
- it "assigns the requested patron_relationship as @patron_relationship" do
341
- put :update, :id => @patron_relationship.id, :patron_relationship => @invalid_attrs
342
- response.should render_template("edit")
343
- end
344
- end
345
- end
346
-
347
- describe "When logged in as User" do
348
- login_user
349
-
350
- describe "with valid params" do
351
- it "updates the requested patron_relationship" do
352
- put :update, :id => @patron_relationship.id, :patron_relationship => @attrs
353
- end
354
-
355
- it "assigns the requested patron_relationship as @patron_relationship" do
356
- put :update, :id => @patron_relationship.id, :patron_relationship => @attrs
357
- assigns(:patron_relationship).should eq(@patron_relationship)
358
- response.should be_forbidden
359
- end
360
- end
361
-
362
- describe "with invalid params" do
363
- it "assigns the requested patron_relationship as @patron_relationship" do
364
- put :update, :id => @patron_relationship.id, :patron_relationship => @invalid_attrs
365
- response.should be_forbidden
366
- end
367
- end
368
- end
369
-
370
- describe "When not logged in" do
371
- describe "with valid params" do
372
- it "updates the requested patron_relationship" do
373
- put :update, :id => @patron_relationship.id, :patron_relationship => @attrs
374
- end
375
-
376
- it "should be forbidden" do
377
- put :update, :id => @patron_relationship.id, :patron_relationship => @attrs
378
- response.should redirect_to(new_user_session_url)
379
- end
380
- end
381
-
382
- describe "with invalid params" do
383
- it "assigns the requested patron_relationship as @patron_relationship" do
384
- put :update, :id => @patron_relationship.id, :patron_relationship => @invalid_attrs
385
- response.should redirect_to(new_user_session_url)
386
- end
387
- end
388
- end
389
- end
390
-
391
- describe "DELETE destroy" do
392
- before(:each) do
393
- @patron_relationship = FactoryGirl.create(:patron_relationship)
394
- end
395
-
396
- describe "When logged in as Administrator" do
397
- login_admin
398
-
399
- it "destroys the requested patron_relationship" do
400
- delete :destroy, :id => @patron_relationship.id
401
- end
402
-
403
- it "redirects to the patron_relationships list" do
404
- delete :destroy, :id => @patron_relationship.id
405
- response.should redirect_to(patron_relationships_url)
406
- end
407
- end
408
-
409
- describe "When logged in as Librarian" do
410
- login_librarian
411
-
412
- it "destroys the requested patron_relationship" do
413
- delete :destroy, :id => @patron_relationship.id
414
- end
415
-
416
- it "redirects to the patron_relationships list" do
417
- delete :destroy, :id => @patron_relationship.id
418
- response.should redirect_to(patron_relationships_url)
419
- end
420
- end
421
-
422
- describe "When logged in as User" do
423
- login_user
424
-
425
- it "destroys the requested patron_relationship" do
426
- delete :destroy, :id => @patron_relationship.id
427
- end
428
-
429
- it "should be forbidden" do
430
- delete :destroy, :id => @patron_relationship.id
431
- response.should be_forbidden
432
- end
433
- end
434
-
435
- describe "When not logged in" do
436
- it "destroys the requested patron_relationship" do
437
- delete :destroy, :id => @patron_relationship.id
438
- end
439
-
440
- it "should be forbidden" do
441
- delete :destroy, :id => @patron_relationship.id
442
- response.should redirect_to(new_user_session_url)
443
- end
444
- end
445
- end
446
- end