enju_leaf 1.1.0.rc12 → 1.1.0.rc13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (367) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/enju.css +0 -1
  3. data/app/controllers/my_accounts_controller.rb +26 -18
  4. data/app/controllers/page_controller.rb +6 -6
  5. data/app/controllers/profiles_controller.rb +155 -0
  6. data/app/controllers/roles_controller.rb +5 -5
  7. data/app/controllers/user_export_files_controller.rb +100 -0
  8. data/app/controllers/user_groups_controller.rb +11 -11
  9. data/app/controllers/user_import_files_controller.rb +22 -11
  10. data/app/controllers/user_import_results_controller.rb +1 -1
  11. data/app/mailers/notifier.rb +7 -7
  12. data/app/models/enju_leaf/ability.rb +14 -13
  13. data/app/models/profile.rb +63 -16
  14. data/app/models/role.rb +2 -2
  15. data/app/models/user_export_file.rb +52 -0
  16. data/app/models/user_export_file_state_machine.rb +15 -0
  17. data/app/models/user_export_file_transition.rb +20 -0
  18. data/app/models/user_group.rb +3 -3
  19. data/app/models/user_has_role.rb +2 -2
  20. data/app/models/user_import_file.rb +139 -53
  21. data/app/views/kaminari/_first_page.html.erb +1 -1
  22. data/app/views/kaminari/_last_page.html.erb +1 -1
  23. data/app/views/kaminari/_next_page.html.erb +1 -1
  24. data/app/views/kaminari/_page.html.erb +1 -1
  25. data/app/views/kaminari/_prev_page.html.erb +1 -1
  26. data/app/views/kaminari/enju_leaf_mobile/_next_page.html.erb +1 -1
  27. data/app/views/kaminari/enju_leaf_mobile/_page.html.erb +1 -1
  28. data/app/views/kaminari/enju_leaf_mobile/_prev_page.html.erb +1 -1
  29. data/app/views/layouts/application.html.erb +4 -4
  30. data/app/views/my_accounts/_edit_credential.html.erb +67 -59
  31. data/app/views/my_accounts/edit.html.erb +6 -46
  32. data/app/views/my_accounts/show.html.erb +8 -8
  33. data/app/views/page/_add.html.erb +2 -2
  34. data/app/views/page/_footer.html.erb +3 -2
  35. data/app/views/page/_footer.mobile.erb +1 -1
  36. data/app/views/page/_header.html.erb +4 -4
  37. data/app/views/page/_include.html.erb +1 -1
  38. data/app/views/page/_index.html.erb +8 -8
  39. data/app/views/page/_index.mobile.erb +4 -4
  40. data/app/views/page/_menu.html.erb +9 -6
  41. data/app/views/page/_msie_acceralator.html.erb +1 -1
  42. data/app/views/page/_position.html.erb +2 -2
  43. data/app/views/page/_search_form.html.erb +2 -2
  44. data/app/views/page/_search_form.mobile.erb +2 -2
  45. data/app/views/page/_select_locale.html.erb +2 -2
  46. data/app/views/page/about.en.html.erb +2 -2
  47. data/app/views/page/about.ja.html.erb +2 -2
  48. data/app/views/page/advanced_search.html.erb +8 -8
  49. data/app/views/page/configuration.html.erb +5 -3
  50. data/app/views/page/export.html.erb +7 -17
  51. data/app/views/page/import.html.erb +1 -4
  52. data/app/views/page/index.html.erb +2 -2
  53. data/app/views/page/msie_acceralator.builder +1 -1
  54. data/app/views/page/opensearch.builder +2 -2
  55. data/app/views/profiles/_edit_credential.html.erb +78 -0
  56. data/app/views/profiles/_edit_profile.html.erb +42 -0
  57. data/app/views/{users → profiles}/_form.html.erb +0 -0
  58. data/app/views/{users → profiles}/_show.html.erb +0 -0
  59. data/app/views/profiles/edit.html.erb +36 -0
  60. data/app/views/profiles/index.html.erb +61 -0
  61. data/app/views/{users → profiles}/new.html.erb +34 -36
  62. data/app/views/{users → profiles}/show.html.erb +24 -22
  63. data/app/views/{users → profiles}/show.mobile.erb +0 -0
  64. data/app/views/roles/_form.html.erb +1 -1
  65. data/app/views/roles/edit.html.erb +1 -1
  66. data/app/views/roles/index.html.erb +2 -2
  67. data/app/views/roles/new.html.erb +1 -1
  68. data/app/views/roles/show.html.erb +1 -1
  69. data/app/views/user_export_files/_form.html.erb +22 -0
  70. data/app/views/user_export_files/edit.html.erb +6 -0
  71. data/app/views/user_export_files/index.html.erb +44 -0
  72. data/app/views/user_export_files/new.html.erb +16 -0
  73. data/app/views/user_export_files/show.html.erb +31 -0
  74. data/app/views/user_groups/_form.html.erb +5 -5
  75. data/app/views/user_groups/edit.html.erb +1 -1
  76. data/app/views/user_groups/index.html.erb +14 -8
  77. data/app/views/user_groups/new.html.erb +1 -1
  78. data/app/views/user_groups/show.html.erb +3 -3
  79. data/app/views/user_import_files/index.html.erb +11 -10
  80. data/app/views/user_import_files/new.html.erb +15 -3
  81. data/app/views/user_import_files/show.html.erb +13 -3
  82. data/app/views/user_import_results/index.html.erb +7 -7
  83. data/app/views/user_import_results/{index.tsv.erb → index.txt.erb} +1 -1
  84. data/app/views/user_import_results/show.html.erb +2 -2
  85. data/app/workers/user_export_file_queue.rb +7 -0
  86. data/config/initializers/mime_types.rb +1 -1
  87. data/config/locales/devise.en.yml +19 -18
  88. data/config/locales/devise.ja.yml +45 -42
  89. data/config/locales/en.yml +214 -0
  90. data/config/locales/ja.yml +10 -6
  91. data/config/locales/translation_en.yml +34 -5
  92. data/config/locales/translation_ja.yml +35 -6
  93. data/config/routes.rb +4 -7
  94. data/db/migrate/20130221154434_add_additional_attributes_to_user.rb +0 -9
  95. data/db/migrate/20140122054321_create_profiles.rb +1 -1
  96. data/db/migrate/20140709113413_create_user_export_files.rb +11 -0
  97. data/db/migrate/20140709113905_create_user_export_file_transitions.rb +14 -0
  98. data/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +5 -0
  99. data/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +5 -0
  100. data/db/migrate/20140811031145_add_expired_at_to_profile.rb +5 -0
  101. data/lib/enju_leaf/calculate_stat.rb +9 -0
  102. data/lib/enju_leaf/controller.rb +1 -1
  103. data/lib/enju_leaf/export_file.rb +26 -0
  104. data/lib/enju_leaf/import_file.rb +25 -0
  105. data/lib/enju_leaf/master_model.rb +15 -6
  106. data/lib/enju_leaf/url_validator.rb +4 -2
  107. data/lib/enju_leaf/user.rb +74 -68
  108. data/lib/enju_leaf/version.rb +1 -1
  109. data/lib/enju_leaf.rb +23 -24
  110. data/lib/generators/enju_leaf/quick_install/quick_install_generator.rb +2 -1
  111. data/lib/generators/enju_leaf/setup/setup_generator.rb +6 -0
  112. data/lib/generators/enju_leaf/setup/templates/db/fixtures/user_groups.yml +1 -1
  113. data/lib/generators/enju_leaf/setup/templates/db/seeds.rb +5 -4
  114. data/lib/tasks/enju_leaf_tasks.rake +18 -9
  115. data/lib/tasks/profile.rb +15 -0
  116. data/spec/controllers/my_accounts_controller_spec.rb +61 -43
  117. data/spec/controllers/page_controller_spec.rb +20 -20
  118. data/spec/controllers/profiles_controller_spec.rb +530 -0
  119. data/spec/controllers/roles_controller_spec.rb +19 -19
  120. data/spec/controllers/user_export_files_controller_spec.rb +297 -0
  121. data/spec/controllers/user_groups_controller_spec.rb +48 -48
  122. data/spec/controllers/user_import_files_controller_spec.rb +45 -41
  123. data/spec/controllers/user_import_results_controller_spec.rb +9 -9
  124. data/spec/dummy/app/models/user.rb +3 -0
  125. data/spec/dummy/config/application.rb +3 -1
  126. data/spec/dummy/config/environments/test.rb +2 -0
  127. data/spec/dummy/db/development.sqlite3 +0 -0
  128. data/spec/dummy/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +1 -2
  129. data/spec/dummy/db/migrate/005_create_manifestations.rb +5 -17
  130. data/spec/dummy/db/migrate/006_create_items.rb +2 -3
  131. data/spec/dummy/db/migrate/032_create_checkins.rb +17 -0
  132. data/spec/dummy/db/migrate/033_create_checkouts.rb +25 -0
  133. data/spec/dummy/db/migrate/035_create_reserves.rb +27 -0
  134. data/spec/dummy/db/migrate/055_create_bookmarks.rb +22 -0
  135. data/spec/dummy/db/migrate/059_create_libraries.rb +5 -1
  136. data/spec/dummy/db/migrate/069_create_shelves.rb +5 -1
  137. data/spec/dummy/db/migrate/080_create_library_groups.rb +0 -2
  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/121_create_checked_items.rb +17 -0
  141. data/spec/dummy/db/migrate/127_create_use_restrictions.rb +16 -0
  142. data/spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb +16 -0
  143. data/spec/dummy/db/migrate/130_create_request_status_types.rb +5 -1
  144. data/spec/dummy/db/migrate/131_create_request_types.rb +5 -1
  145. data/spec/dummy/db/migrate/132_create_circulation_statuses.rb +16 -0
  146. data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
  147. data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
  148. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
  149. data/spec/dummy/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +1 -1
  150. data/spec/dummy/db/migrate/{20081028083142_create_patron_import_files.rb → 20081028083142_create_agent_import_files.rb} +2 -4
  151. data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +1 -3
  152. data/spec/dummy/db/migrate/20081030023412_create_checkout_types.rb +17 -0
  153. data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +25 -0
  154. data/spec/dummy/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb +18 -0
  155. data/spec/dummy/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb +17 -0
  156. data/spec/dummy/db/migrate/20081212080038_create_manifestation_checkout_stats.rb +16 -0
  157. data/spec/dummy/db/migrate/20081212151614_create_bookmark_stats.rb +16 -0
  158. data/spec/dummy/db/migrate/20081212151820_create_bookmark_stat_has_manifestations.rb +13 -0
  159. data/spec/dummy/db/migrate/20081215094302_create_user_checkout_stats.rb +16 -0
  160. data/spec/dummy/db/migrate/20081215094955_create_checkout_stat_has_users.rb +17 -0
  161. data/spec/dummy/db/migrate/20081216190517_create_reserve_stat_has_manifestations.rb +17 -0
  162. data/spec/dummy/db/migrate/20081216190724_create_manifestation_reserve_stats.rb +16 -0
  163. data/spec/dummy/db/migrate/20081220023628_create_user_reserve_stats.rb +16 -0
  164. data/spec/dummy/db/migrate/20081220034117_create_reserve_stat_has_users.rb +17 -0
  165. data/spec/dummy/db/migrate/20090321130448_add_completed_at_to_user_checkout_stat.rb +27 -0
  166. data/spec/dummy/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +1 -1
  167. data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +21 -0
  168. data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +0 -1
  169. data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +9 -0
  170. data/spec/dummy/db/migrate/20100525171356_acts_as_taggable_on_migration.rb +30 -0
  171. data/spec/dummy/db/migrate/{20100606073747_create_patron_relationships.rb → 20100606073747_create_agent_relationships.rb} +1 -1
  172. data/spec/dummy/db/migrate/{20100814091104_add_position_to_patron_relationship.rb → 20100814091104_add_position_to_agent_relationship.rb} +1 -1
  173. data/spec/dummy/db/migrate/{20100925074559_create_patron_import_results.rb → 20100925074559_create_agent_import_results.rb} +1 -1
  174. data/spec/dummy/db/migrate/{20110301121550_add_birth_date_and_death_date_to_patron.rb → 20110301121550_add_birth_date_and_death_date_to_agent.rb} +1 -1
  175. data/spec/dummy/db/migrate/20110301134521_add_expire_date_to_reserve.rb +9 -0
  176. data/spec/dummy/db/migrate/20110328130826_add_current_checkout_count_to_user_group_has_checkout_type.rb +9 -0
  177. data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +1 -1
  178. data/spec/dummy/db/migrate/20110621093332_remove_expire_date_from_reserve.rb +9 -0
  179. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
  180. data/spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb +11 -0
  181. data/spec/dummy/db/migrate/20111217234412_add_save_checkout_history_to_user.rb +5 -0
  182. data/spec/dummy/db/migrate/20111218002349_add_checkout_icalendar_token_to_user.rb +6 -0
  183. data/spec/dummy/db/migrate/20111231145823_add_share_bookmarks_to_user.rb +5 -0
  184. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
  185. data/spec/dummy/db/migrate/{20120413161403_add_fingerprint_to_patron_import_file.rb → 20120413161403_add_fingerprint_to_agent_import_file.rb} +1 -1
  186. data/spec/dummy/db/migrate/{20120413170720_add_error_message_to_patron_import_file.rb → 20120413170720_add_error_message_to_agent_import_file.rb} +1 -1
  187. data/spec/dummy/db/migrate/20120418121539_add_save_search_history_to_user.rb +5 -0
  188. data/spec/dummy/db/migrate/20120424103932_add_librarian_id_to_checked_item.rb +5 -0
  189. data/spec/dummy/db/migrate/{20120511072422_add_patron_identifier_to_patron.rb → 20120511072422_add_agent_identifier_to_agent.rb} +1 -1
  190. data/spec/dummy/db/migrate/{20120602141129_add_edit_mode_to_patron_import_file.rb → 20120602141129_add_edit_mode_to_agent_import_file.rb} +1 -1
  191. data/spec/dummy/db/migrate/20130303104849_add_state_index_to_reserve.rb +5 -0
  192. data/spec/dummy/db/migrate/20130303124821_add_retained_at_to_reserve.rb +5 -0
  193. data/spec/dummy/db/migrate/20130304015019_add_postponed_at_to_reserve.rb +5 -0
  194. data/spec/dummy/db/migrate/20130416054135_add_circulation_status_id_to_item.rb +8 -0
  195. data/spec/dummy/db/migrate/20130421155019_add_creator_string_to_series_statement.rb +7 -0
  196. data/spec/dummy/db/migrate/20130421164124_add_series_master_to_series_statement.rb +5 -0
  197. data/spec/dummy/db/migrate/20130509185724_add_statement_of_responsibility_to_manifestation.rb +5 -0
  198. data/spec/dummy/db/migrate/20130519065638_add_lock_version_to_reserve.rb +5 -0
  199. data/spec/dummy/db/migrate/20130519065837_add_lock_version_to_checkin.rb +5 -0
  200. data/spec/dummy/db/migrate/20140518050147_create_reserve_transitions.rb +14 -0
  201. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +14 -0
  202. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +14 -0
  203. data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +14 -0
  204. data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +14 -0
  205. data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +14 -0
  206. data/spec/dummy/db/migrate/20140524135607_create_bookmark_stat_transitions.rb +14 -0
  207. data/spec/dummy/db/migrate/20140524142813_add_taggings_count_to_tag.rb +5 -0
  208. data/spec/dummy/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +14 -0
  209. data/spec/dummy/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +14 -0
  210. data/spec/dummy/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +14 -0
  211. data/spec/dummy/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +14 -0
  212. data/spec/dummy/db/migrate/20140529014410_create_item_transitions.rb +14 -0
  213. data/spec/dummy/db/migrate/20140614065404_create_resource_export_files.rb +11 -0
  214. data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +14 -0
  215. data/spec/dummy/db/migrate/20140628073524_add_user_encoding_to_agent_import_file.rb +5 -0
  216. data/spec/dummy/db/migrate/20140628073535_add_user_encoding_to_resource_import_file.rb +5 -0
  217. data/spec/dummy/db/migrate/20140810061942_add_user_id_to_stat.rb +12 -0
  218. data/spec/dummy/db/migrate/20140810091231_add_checkout_icalendar_token_to_profile.rb +6 -0
  219. data/spec/dummy/db/migrate/20140810091417_add_save_checkout_history_to_profile.rb +5 -0
  220. data/spec/dummy/db/migrate/20140811132912_add_save_search_history_to_profile.rb +5 -0
  221. data/spec/dummy/db/migrate/20140812093836_add_share_bookmarks_to_profile.rb +5 -0
  222. data/spec/dummy/db/schema.rb +632 -57
  223. data/spec/dummy/db/test.sqlite3 +0 -0
  224. data/spec/dummy/private/system/user_import_files/user_imports/980/190/963/original/user_delete_file.tsv +4 -0
  225. data/spec/dummy/private/system/user_import_files/user_imports/980/190/963/original/user_import_file_sample.tsv +7 -7
  226. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140815-3963-1s1td26.txt +8 -0
  227. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140815-69229-i0rcty.txt +8 -0
  228. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20140816-21120-1w731r8.txt +8 -0
  229. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140711-28652-1dj3e98.txt +148 -0
  230. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140711-29117-13jb6ol.txt +148 -0
  231. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140721-65743-1tnagd4.txt +8 -0
  232. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140815-3963-1kk8o87.txt +8 -0
  233. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140815-69229-188nwub.txt +8 -0
  234. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20140816-21120-twzfb6.txt +8 -0
  235. data/spec/dummy/solr/default/data/index/_4h.fdt +0 -0
  236. data/spec/dummy/solr/default/data/index/{_3h.fdx → _4h.fdx} +0 -0
  237. data/spec/dummy/solr/default/data/index/{_3h.fnm → _4h.fnm} +0 -0
  238. data/spec/dummy/solr/default/data/index/{_3h.nvd → _4h.nvd} +0 -0
  239. data/spec/dummy/solr/default/data/index/{_3h.nvm → _4h.nvm} +0 -0
  240. data/spec/dummy/solr/default/data/index/{_3h.si → _4h.si} +0 -0
  241. data/spec/dummy/solr/default/data/index/_4h_Lucene41_0.doc +0 -0
  242. data/spec/dummy/solr/default/data/index/_4h_Lucene41_0.pos +0 -0
  243. data/spec/dummy/solr/default/data/index/_4h_Lucene41_0.tim +0 -0
  244. data/spec/dummy/solr/default/data/index/_4h_Lucene41_0.tip +0 -0
  245. data/spec/dummy/solr/default/data/index/segments.gen +0 -0
  246. data/spec/dummy/solr/default/data/index/segments_97 +0 -0
  247. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000320 +0 -0
  248. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000321 +0 -0
  249. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000322 +0 -0
  250. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000323 +0 -0
  251. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000324 +0 -0
  252. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000325 +0 -0
  253. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000326 +0 -0
  254. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000327 +0 -0
  255. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000328 +0 -0
  256. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000329 +0 -0
  257. data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
  258. data/spec/dummy/tmp/cache/ACB/B20/manifestation_search_total +0 -0
  259. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  260. data/spec/dummy/tmp/cache/assets/test/sprockets/154f7b83f2da0e86effbe25f32135177 +0 -0
  261. data/spec/dummy/tmp/cache/assets/test/sprockets/1b984bdbd3204a51a82d0e01a1569e2d +0 -0
  262. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  263. data/spec/dummy/tmp/cache/assets/test/sprockets/3054c50144654f9c7e57bb0639a276e9 +0 -0
  264. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  265. data/spec/dummy/tmp/cache/assets/test/sprockets/3bd7a263237ba366f64d938fe5303757 +0 -0
  266. data/spec/dummy/tmp/cache/assets/test/sprockets/62899096da1a3e67660f3b88068be8c9 +0 -0
  267. data/spec/dummy/tmp/cache/assets/test/sprockets/65b2e4f67eab21b30217e29075f433b2 +0 -0
  268. data/spec/dummy/tmp/cache/assets/test/sprockets/87d24a3f43f175d4d17babe9203c79a7 +0 -0
  269. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  270. data/spec/dummy/tmp/cache/assets/test/sprockets/d38d8658b30de1d068603968227680d4 +0 -0
  271. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  272. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  273. data/spec/dummy/tmp/cache/stdout +246 -279
  274. data/spec/dummy/tmp/pids/redis-test.pid +1 -1
  275. data/spec/factories/profile.rb +9 -0
  276. data/spec/factories/user.rb +0 -13
  277. data/spec/fixtures/agent_import_files.yml +0 -3
  278. data/spec/fixtures/agents.yml +54 -54
  279. data/spec/fixtures/baskets.yml +4 -4
  280. data/spec/fixtures/carrier_type_has_checkout_types.yml +30 -0
  281. data/spec/fixtures/checked_items.yml +34 -0
  282. data/spec/fixtures/checkins.yml +54 -0
  283. data/spec/fixtures/checkout_stat_has_manifestations.yml +23 -0
  284. data/spec/fixtures/checkout_stat_has_users.yml +23 -0
  285. data/spec/fixtures/checkout_types.yml +33 -0
  286. data/spec/fixtures/checkouts.yml +162 -0
  287. data/spec/fixtures/circulation_statuses.yml +119 -0
  288. data/spec/fixtures/event_categories.yml +55 -0
  289. data/spec/fixtures/events.yml +142 -0
  290. data/spec/fixtures/exemplifies.yml +12 -0
  291. data/spec/fixtures/import_requests.yml +0 -2
  292. data/spec/fixtures/item_has_use_restrictions.yml +60 -0
  293. data/spec/fixtures/items.yml +101 -11
  294. data/spec/fixtures/lending_policies.yml +98 -0
  295. data/spec/fixtures/libraries.yml +26 -25
  296. data/spec/fixtures/library_groups.yml +6 -8
  297. data/spec/fixtures/manifestation_checkout_stats.yml +30 -0
  298. data/spec/fixtures/manifestation_reserve_stats.yml +30 -0
  299. data/spec/fixtures/manifestations.yml +69 -207
  300. data/spec/fixtures/message_requests.yml +27 -0
  301. data/spec/fixtures/message_templates.yml +105 -0
  302. data/spec/fixtures/profiles.yml +98 -0
  303. data/spec/fixtures/request_status_types.yml +63 -0
  304. data/spec/fixtures/request_types.yml +55 -0
  305. data/spec/fixtures/reserve_stat_has_manifestations.yml +23 -0
  306. data/spec/fixtures/reserve_stat_has_users.yml +23 -0
  307. data/spec/fixtures/reserve_transitions.yml +88 -0
  308. data/spec/fixtures/reserves.yml +162 -0
  309. data/spec/fixtures/resource_import_files.yml +0 -3
  310. data/spec/fixtures/roles.yml +0 -4
  311. data/spec/fixtures/shelves.yml +2 -3
  312. data/spec/fixtures/use_restrictions.yml +92 -0
  313. data/spec/fixtures/user_checkout_stats.yml +30 -0
  314. data/spec/fixtures/user_export_files.yml +26 -0
  315. data/spec/fixtures/user_group_has_checkout_types.yml +110 -0
  316. data/spec/fixtures/user_import_files.yml +2 -0
  317. data/spec/fixtures/user_reserve_stats.yml +30 -0
  318. data/spec/fixtures/users.yml +1 -101
  319. data/spec/models/profile_spec.rb +66 -0
  320. data/spec/models/user_export_file_spec.rb +31 -0
  321. data/spec/models/user_import_file_spec.rb +42 -20
  322. data/spec/models/user_spec.rb +1 -18
  323. data/spec/requests/{users_spec.rb → profiles_spec.rb} +3 -3
  324. data/spec/routing/accounts_spec.rb +1 -1
  325. data/spec/routing/profiles_routing_spec.rb +35 -0
  326. data/spec/support/resque.rb +1 -0
  327. data/spec/views/{users → profiles}/edit.html.erb_spec.rb +5 -7
  328. data/spec/views/{users → profiles}/index.html.erb_spec.rb +3 -3
  329. data/spec/views/{users → profiles}/new.html.erb_spec.rb +5 -5
  330. data/spec/views/profiles/show.html.erb_spec.rb +20 -0
  331. data/vendor/assets/javascripts/jquery.colorbox.js +4 -3
  332. data/vendor/assets/stylesheets/colorbox.css +1 -1
  333. metadata +416 -132
  334. data/app/controllers/users_controller.rb +0 -195
  335. data/app/models/user_sweeper.rb +0 -18
  336. data/app/views/users/_edit_credential.html.erb +0 -79
  337. data/app/views/users/edit.html.erb +0 -76
  338. data/app/views/users/index.html.erb +0 -56
  339. data/lib/enju_leaf/expire_editable_fragment.rb +0 -30
  340. data/lib/enju_leaf/expire_fragment_cache.rb +0 -17
  341. data/spec/controllers/users_controller_spec.rb +0 -539
  342. data/spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +0 -13
  343. data/spec/dummy/db/migrate/20120415060308_rename_resource_import_file_imported_at_to_executed_at.rb +0 -9
  344. data/spec/dummy/db/migrate/20120415060323_rename_patron_import_file_imported_at_to_executed_at.rb +0 -9
  345. data/spec/dummy/db/migrate/20121119153944_add_manifestation_id_to_item.rb +0 -5
  346. data/spec/dummy/solr/default/data/index/_3h.fdt +0 -0
  347. data/spec/dummy/solr/default/data/index/_3h_Lucene41_0.doc +0 -0
  348. data/spec/dummy/solr/default/data/index/_3h_Lucene41_0.pos +0 -0
  349. data/spec/dummy/solr/default/data/index/_3h_Lucene41_0.tim +0 -0
  350. data/spec/dummy/solr/default/data/index/_3h_Lucene41_0.tip +0 -0
  351. data/spec/dummy/solr/default/data/index/segments_71 +0 -0
  352. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000242 +0 -0
  353. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000243 +0 -0
  354. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000244 +0 -0
  355. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000245 +0 -0
  356. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000246 +0 -0
  357. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000247 +0 -0
  358. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000248 +0 -0
  359. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000249 +0 -0
  360. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000250 +0 -0
  361. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000251 +0 -0
  362. data/spec/dummy/tmp/cache/assets/test/sprockets/3f8d795856d1fdf902b0be679120571a +0 -0
  363. data/spec/dummy/tmp/cache/assets/test/sprockets/5998e66e374537d52eed3fe1ca5f2bfc +0 -0
  364. data/spec/dummy/tmp/cache/assets/test/sprockets/5ea4a1824e1d67da6c4fb9aeef9f49f4 +0 -0
  365. data/spec/dummy/tmp/cache/assets/test/sprockets/87f0cb69a0df1355e33cce3949919d5a +0 -0
  366. data/spec/routing/users_routing_spec.rb +0 -35
  367. data/spec/views/users/show.html.erb_spec.rb +0 -15
@@ -0,0 +1,92 @@
1
+ ---
2
+ use_restriction_00001:
3
+ name: Available For Supply Without Return
4
+ display_name: Available For Supply Without Return
5
+ id: 1
6
+ position: 1
7
+ note: ""
8
+ use_restriction_00002:
9
+ name: In Library Use Only
10
+ display_name: In Library Use Only
11
+ id: 2
12
+ position: 2
13
+ note: ""
14
+ use_restriction_00003:
15
+ name: Limited Circulation, Long Loan Period
16
+ display_name: Limited Circulation, Long Loan Period
17
+ id: 3
18
+ position: 3
19
+ note: ""
20
+ use_restriction_00004:
21
+ name: Limited Circulation, Normal Loan Period
22
+ display_name: Limited Circulation, Normal Loan Period
23
+ id: 4
24
+ position: 4
25
+ note: ""
26
+ use_restriction_00005:
27
+ name: Limited Circulation, Short Loan Period
28
+ display_name: Limited Circulation, Short Loan Period
29
+ id: 5
30
+ position: 5
31
+ note: ""
32
+ use_restriction_00006:
33
+ name: No Reproduction
34
+ display_name: No Reproduction
35
+ id: 6
36
+ position: 6
37
+ note: ""
38
+ use_restriction_00007:
39
+ name: Not For Loan
40
+ display_name: Not For Loan
41
+ id: 7
42
+ position: 7
43
+ note: ""
44
+ use_restriction_00008:
45
+ name: Overnight Only
46
+ display_name: Overnight Only
47
+ id: 8
48
+ position: 8
49
+ note: ""
50
+ use_restriction_00009:
51
+ name: Renewals Not Permitted
52
+ display_name: Renewals Not Permitted
53
+ id: 9
54
+ position: 9
55
+ note: ""
56
+ use_restriction_00010:
57
+ name: Supervision Required
58
+ display_name: Supervision Required
59
+ id: 10
60
+ position: 10
61
+ note: ""
62
+ use_restriction_00011:
63
+ name: Term Loan
64
+ display_name: Term Loan
65
+ id: 11
66
+ position: 11
67
+ note: ""
68
+ use_restriction_00012:
69
+ name: Use Only In Controlled Access
70
+ display_name: Use Only In Controlled Access
71
+ id: 12
72
+ position: 12
73
+ note: ""
74
+ use_restriction_00013:
75
+ name: User Signature Required
76
+ display_name: User Signature Required
77
+ id: 13
78
+ position: 13
79
+ note: ""
80
+
81
+ # == Schema Information
82
+ #
83
+ # Table name: use_restrictions
84
+ #
85
+ # id :integer not null, primary key
86
+ # name :string(255) not null
87
+ # display_name :text
88
+ # note :text
89
+ # position :integer
90
+ # created_at :datetime
91
+ # updated_at :datetime
92
+ #
@@ -0,0 +1,30 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ id: 1
5
+ start_date: 2008-12-15 18:43:02
6
+ end_date: 2008-12-16 18:43:02
7
+ note: MyText
8
+ state: pending
9
+
10
+ two:
11
+ id: 2
12
+ start_date: 2008-12-15 18:43:02
13
+ end_date: 2008-12-16 18:43:02
14
+ note: MyText
15
+ state: pending
16
+
17
+ # == Schema Information
18
+ #
19
+ # Table name: user_checkout_stats
20
+ #
21
+ # id :integer not null, primary key
22
+ # start_date :datetime
23
+ # end_date :datetime
24
+ # note :text
25
+ # state :string(255)
26
+ # created_at :datetime
27
+ # updated_at :datetime
28
+ # started_at :datetime
29
+ # completed_at :datetime
30
+ #
@@ -0,0 +1,26 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ user_export_file_00001:
4
+ id: 1
5
+ user_id: 1
6
+ user_export_file_00002:
7
+ id: 2
8
+ user_id: 1
9
+ user_export_file_00003:
10
+ id: 3
11
+ user_id: 1
12
+
13
+ # == Schema Information
14
+ #
15
+ # Table name: user_export_files
16
+ #
17
+ # id :integer not null, primary key
18
+ # user_id :integer
19
+ # user_export_file_name :string(255)
20
+ # user_export_content_type :string(255)
21
+ # user_export_file_size :integer
22
+ # user_export_updated_at :datetime
23
+ # executed_at :datetime
24
+ # created_at :datetime not null
25
+ # updated_at :datetime not null
26
+ #
@@ -0,0 +1,110 @@
1
+ ---
2
+ user_group_has_checkout_type_00001:
3
+ checkout_type_id: 1
4
+ updated_at: 2007-12-23 03:13:08.107022 +09:00
5
+ checkout_limit: 3
6
+ reservation_limit: 2
7
+ user_group_id: 1
8
+ checkout_period: 0
9
+ checkout_renewal_limit: 1
10
+ id: 1
11
+ created_at: 2007-12-23 03:13:08.107022 +09:00
12
+ set_due_date_before_closing_day: false
13
+ user_group_has_checkout_type_00002:
14
+ checkout_type_id: 2
15
+ updated_at: 2007-12-23 03:13:15.620143 +09:00
16
+ checkout_limit: 3
17
+ reservation_limit: 2
18
+ user_group_id: 1
19
+ checkout_period: 10
20
+ checkout_renewal_limit: 1
21
+ id: 2
22
+ created_at: 2007-12-23 03:13:15.620143 +09:00
23
+ set_due_date_before_closing_day: false
24
+ user_group_has_checkout_type_00003:
25
+ checkout_type_id: 1
26
+ updated_at: 2007-12-23 03:13:23.416856 +09:00
27
+ checkout_limit: 3
28
+ reservation_limit: 2
29
+ user_group_id: 2
30
+ checkout_period: 21
31
+ checkout_renewal_limit: 1
32
+ id: 3
33
+ created_at: 2007-12-23 03:13:23.416856 +09:00
34
+ set_due_date_before_closing_day: false
35
+ user_group_has_checkout_type_00004:
36
+ checkout_type_id: 2
37
+ updated_at: 2007-12-23 03:13:29.880538 +09:00
38
+ checkout_limit: 3
39
+ reservation_limit: 2
40
+ user_group_id: 2
41
+ checkout_period: 21
42
+ checkout_renewal_limit: 1
43
+ id: 4
44
+ created_at: 2007-12-23 03:13:29.880538 +09:00
45
+ set_due_date_before_closing_day: false
46
+ user_group_has_checkout_type_00005:
47
+ checkout_type_id: 1
48
+ updated_at: 2007-12-23 03:13:37.440462 +09:00
49
+ checkout_limit: 3
50
+ reservation_limit: 3
51
+ user_group_id: 3
52
+ checkout_period: 14
53
+ checkout_renewal_limit: 1
54
+ id: 5
55
+ created_at: 2007-12-23 03:13:37.440462 +09:00
56
+ set_due_date_before_closing_day: false
57
+ user_group_has_checkout_type_00006:
58
+ checkout_type_id: 2
59
+ updated_at: 2007-12-23 03:13:46.312751 +09:00
60
+ checkout_limit: 3
61
+ reservation_limit: 3
62
+ user_group_id: 3
63
+ checkout_period: 7
64
+ checkout_renewal_limit: 1
65
+ id: 6
66
+ created_at: 2007-12-23 03:13:46.312751 +09:00
67
+ set_due_date_before_closing_day: false
68
+ user_group_has_checkout_type_00007:
69
+ checkout_type_id: 3
70
+ updated_at: 2007-12-23 03:13:46.312751 +09:00
71
+ checkout_limit: 3
72
+ reservation_limit: 3
73
+ user_group_id: 2
74
+ checkout_period: 3
75
+ checkout_renewal_limit: 1
76
+ id: 7
77
+ created_at: 2007-12-23 03:13:46.312751 +09:00
78
+ set_due_date_before_closing_day: true
79
+ user_group_has_checkout_type_00008:
80
+ checkout_type_id: 3
81
+ updated_at: 2007-12-23 03:13:46.312751 +09:00
82
+ checkout_limit: 3
83
+ reservation_limit: 3
84
+ user_group_id: 1
85
+ checkout_period: 3
86
+ checkout_renewal_limit: 1
87
+ id: 8
88
+ created_at: 2007-12-23 03:13:46.312751 +09:00
89
+ set_due_date_before_closing_day: true
90
+
91
+ # == Schema Information
92
+ #
93
+ # Table name: user_group_has_checkout_types
94
+ #
95
+ # id :integer not null, primary key
96
+ # user_group_id :integer not null
97
+ # checkout_type_id :integer not null
98
+ # checkout_limit :integer default(0), not null
99
+ # checkout_period :integer default(0), not null
100
+ # checkout_renewal_limit :integer default(0), not null
101
+ # reservation_limit :integer default(0), not null
102
+ # reservation_expired_period :integer default(7), not null
103
+ # set_due_date_before_closing_day :boolean default(FALSE), not null
104
+ # fixed_due_date :datetime
105
+ # note :text
106
+ # position :integer
107
+ # created_at :datetime
108
+ # updated_at :datetime
109
+ # current_checkout_count :integer
110
+ #
@@ -42,4 +42,6 @@ two:
42
42
  # created_at :datetime not null
43
43
  # updated_at :datetime not null
44
44
  # user_encoding :string(255)
45
+ # default_library_id :integer
46
+ # default_user_group_id :integer
45
47
  #
@@ -0,0 +1,30 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ id: 1
5
+ start_date: 2008-12-20 11:36:28
6
+ end_date: 2008-12-21 11:36:28
7
+ note: MyText
8
+ state: pending
9
+
10
+ two:
11
+ id: 2
12
+ start_date: 2008-12-20 11:36:28
13
+ end_date: 2008-12-21 11:36:28
14
+ note: MyText
15
+ state: pending
16
+
17
+ # == Schema Information
18
+ #
19
+ # Table name: user_reserve_stats
20
+ #
21
+ # id :integer not null, primary key
22
+ # start_date :datetime
23
+ # end_date :datetime
24
+ # note :text
25
+ # state :string(255)
26
+ # created_at :datetime
27
+ # updated_at :datetime
28
+ # started_at :datetime
29
+ # completed_at :datetime
30
+ #
@@ -1,151 +1,51 @@
1
1
  ---
2
2
  admin:
3
3
  updated_at: 2008-05-31 13:16:30.163731 +09:00
4
- expired_at:
5
4
  encrypted_password: $2a$10$vHohD1WflnTIqAa8zMkF9evwAgIZRw3XuR4d3bi29M.jph/MB/AJi
6
- deleted_at:
7
- user_group_id: 2
8
5
  id: 1
9
- note:
10
6
  username: admin
11
- library_id: 2
12
7
  email: tanabe@kamata.lib.teu.ac.jp
13
8
  created_at: 2007-11-19 16:58:32.111941 +09:00
14
- confirmed_at: 2007-11-19 16:58:32.111941 +09:00
15
- required_role_id: 4
16
- user_number: "00001"
17
- locale: "ja"
18
9
  librarian1:
19
10
  updated_at: 2008-05-31 12:41:16.337474 +09:00
20
- expired_at:
21
11
  encrypted_password: $2a$10$9O2VuTccN4gHq36ARg0QReSrb1D7WrBBhZZ759RM9moHbB0W5zCzS
22
- deleted_at:
23
- user_group_id: 1
24
12
  id: 2
25
- note:
26
13
  username: librarian1
27
- library_id: 1
28
14
  email: librarian1@kamata.lib.teu.ac.jp
29
15
  created_at: 2007-11-19 16:58:33.172441 +09:00
30
- confirmed_at: 2007-11-19 16:58:33.172441 +09:00
31
- required_role_id: 1
32
- user_number: "00002"
33
- locale: "ja"
34
16
  user1:
35
17
  updated_at: 2008-05-31 13:02:25.101261 +09:00
36
- expired_at:
37
18
  encrypted_password: $2a$10$JthS59A0BNkDOoFpCXM0V.GhhffKaoWKbzpPahYp/vTFrOyM7h/uW
38
- deleted_at:
39
- user_group_id: 1
40
19
  id: 3
41
- note:
42
20
  username: user1
43
- library_id: 2
44
21
  email: user1@kamata.lib.teu.ac.jp
45
22
  created_at: 2007-11-19 16:58:34.637413 +09:00
46
- confirmed_at: 2007-11-19 16:58:34.637413 +09:00
47
- required_role_id: 3
48
- user_number: "00003"
49
- locale: "ja"
50
23
  librarian2:
51
24
  updated_at: 2008-05-31 12:42:23.340575 +09:00
52
- expired_at:
53
25
  encrypted_password: $2a$10$YmmTGrYQ1Ir6oc7wXnp.GuNeO1eYLoP3sv8wMSIrTdaGw2BPwRrpS
54
- deleted_at:
55
- user_group_id: 1
56
26
  id: 4
57
- note:
58
27
  username: librarian2
59
- library_id: 2
60
28
  email: librarian2@library.example.jp
61
29
  created_at: 2008-01-18 12:24:04.222344 +09:00
62
- confirmed_at: 2008-01-18 12:24:04.222344 +09:00
63
- required_role_id: 1
64
- user_number: "00004"
65
- locale: "ja"
66
30
  user2:
67
31
  updated_at: 2008-05-31 12:42:44.711117 +09:00
68
- expired_at:
69
32
  encrypted_password: $2a$10$i7UjJhLVrJM/J7qaTwW39OXw1NiwowUEbtNHVDV0sqMLjX9.UO9ca
70
- deleted_at:
71
- user_group_id: 1
72
33
  id: 5
73
- note:
74
34
  username: user2
75
- library_id: 1
76
35
  email: user2@library.example.jp
77
36
  created_at: 2008-01-18 13:29:06.922728 +09:00
78
- confirmed_at: 2008-01-18 13:29:06.922728 +09:00
79
- required_role_id: 2
80
- # user_number: '00005'
81
- locale: "ja"
82
37
  user3:
83
38
  updated_at: 2008-05-31 13:02:25.101261 +09:00
84
- expired_at: <%= 1.day.ago %>
85
39
  encrypted_password: cc53de0c2d9a1a228daa9a673ec824473747e17507a6c3c4f7e5eff8821f531d4b9e23616b3ddc66fe17006b2298a556fbd567ac080e87f00f37eef8cee6c417
86
- deleted_at:
87
- user_group_id: 1
88
40
  id: 6
89
- note:
90
41
  username: user3
91
- library_id: 2
92
42
  email: user3@kamata.lib.teu.ac.jp
93
43
  created_at: 2007-11-19 16:58:34.637413 +09:00
94
- required_role_id: 3
95
- user_number: "00006"
96
- locale: "ja"
97
44
  user4:
98
45
  updated_at: 2008-05-31 13:02:25.101261 +09:00
99
- expired_at:
100
46
  encrypted_password: cc53de0c2d9a1a228daa9a673ec824473747e17507a6c3c4f7e5eff8821f531d4b9e23616b3ddc66fe17006b2298a556fbd567ac080e87f00f37eef8cee6c417
101
- deleted_at:
102
- user_group_id: 1
103
47
  id: 7
104
- note:
105
48
  username: user4
106
- library_id: 2
107
- locked_at: <%= 1.day.ago %>
108
49
  email: user4@kamata.lib.teu.ac.jp
109
50
  created_at: 2007-11-19 16:58:34.637413 +09:00
110
- required_role_id: 3
111
- user_number: "00007"
112
- locale: "ja"
113
- # == Schema Information
114
- #
115
- # Table name: users
116
- #
117
- # id :integer not null, primary key
118
- # email :string(255) default(""), not null
119
- # encrypted_password :string(255) default(""), not null
120
- # reset_password_token :string(255)
121
- # reset_password_sent_at :datetime
122
- # remember_created_at :datetime
123
- # sign_in_count :integer default(0)
124
- # current_sign_in_at :datetime
125
- # last_sign_in_at :datetime
126
- # current_sign_in_ip :string(255)
127
- # last_sign_in_ip :string(255)
128
- # confirmation_token :string(255)
129
- # confirmed_at :datetime
130
- # confirmation_sent_at :datetime
131
- # unconfirmed_email :string(255)
132
- # failed_attempts :integer default(0)
133
- # unlock_token :string(255)
134
- # locked_at :datetime
135
- # authentication_token :string(255)
136
- # created_at :datetime not null
137
- # updated_at :datetime not null
138
- # deleted_at :datetime
139
- # username :string(255) not null
140
- # library_id :integer default(1), not null
141
- # user_group_id :integer default(1), not null
142
- # expired_at :datetime
143
- # required_role_id :integer default(1), not null
144
- # note :text
145
- # keyword_list :text
146
- # user_number :string(255)
147
- # state :string(255)
148
- # locale :string(255)
149
- # enju_access_key :string(255)
150
- #
151
-
51
+ locked_at: <%= 1.day.ago %>
@@ -0,0 +1,66 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe Profile do
5
+ #pending "add some examples to (or delete) #{__FILE__}"
6
+ fixtures :all
7
+
8
+ it 'should create a profile' do
9
+ FactoryGirl.create(:profile)
10
+ end
11
+
12
+ it 'should destroy a profile' do
13
+ profile = FactoryGirl.create(:profile)
14
+ profile.destroy.should be_truthy
15
+ end
16
+
17
+ it 'should not set expired_at if its user group does not have valid period' do
18
+ profile = FactoryGirl.create(:profile)
19
+ profile.expired_at.should be_nil
20
+ end
21
+
22
+ it 'should set expired_at if its user group has valid period' do
23
+ profile = FactoryGirl.build(:profile)
24
+ user_group = FactoryGirl.create(:user_group, :valid_period_for_new_user => 10)
25
+ user_group.profiles << profile
26
+ profile.user_group.valid_period_for_new_user.should eq 10
27
+ profile.expired_at.should eq 10.days.from_now.end_of_day
28
+ end
29
+
30
+ it "should create profile" do
31
+ profile = FactoryGirl.create(:profile)
32
+ assert !profile.new_record?, "#{profile.errors.full_messages.to_sentence}"
33
+ end
34
+
35
+ if defined?(EnjuQuestion)
36
+ it "should reset answer_feed_token" do
37
+ profiles(:user1).reset_answer_feed_token
38
+ profiles(:user1).answer_feed_token.should be_truthy
39
+ end
40
+
41
+ it "should delete answer_feed_token" do
42
+ profiles(:user1).delete_answer_feed_token
43
+ profiles(:user1).answer_feed_token.should be_nil
44
+ end
45
+ end
46
+
47
+ if defined?(EnjuCirculation)
48
+ it "should reset checkout_icalendar_token" do
49
+ profiles(:user1).reset_checkout_icalendar_token
50
+ profiles(:user1).checkout_icalendar_token.should be_truthy
51
+ end
52
+
53
+ it "should delete checkout_icalendar_token" do
54
+ profiles(:user1).delete_checkout_icalendar_token
55
+ profiles(:user1).checkout_icalendar_token.should be_nil
56
+ end
57
+ end
58
+
59
+ if defined?(EnjuCirculation)
60
+ it "should send_message" do
61
+ assert profiles(:librarian1).user.send_message('reservation_expired_for_patron', :manifestations => profiles(:librarian1).user.reserves.not_sent_expiration_notice_to_patron.collect(&:manifestation))
62
+ profiles(:librarian1).reload
63
+ profiles(:librarian1).user.reserves.not_sent_expiration_notice_to_patron.should be_empty
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe UserExportFile do
5
+ fixtures :all
6
+
7
+ it "should export in background" do
8
+ message_count = Message.count
9
+ file = UserExportFile.new
10
+ file.user = users(:admin)
11
+ file.save
12
+ UserExportFileQueue.perform(file.id).should be_truthy
13
+ Message.count.should eq message_count + 1
14
+ Message.order(:id).last.subject.should eq 'エクスポートが完了しました'
15
+ end
16
+ end
17
+
18
+ # == Schema Information
19
+ #
20
+ # Table name: user_export_files
21
+ #
22
+ # id :integer not null, primary key
23
+ # user_id :integer
24
+ # user_export_file_name :string(255)
25
+ # user_export_content_type :string(255)
26
+ # user_export_file_size :integer
27
+ # user_export_updated_at :datetime
28
+ # executed_at :datetime
29
+ # created_at :datetime not null
30
+ # updated_at :datetime not null
31
+ #
@@ -7,6 +7,8 @@ describe UserImportFile do
7
7
  describe "when its mode is 'create'" do
8
8
  before(:each) do
9
9
  @file = UserImportFile.new :user_import => File.new("#{Rails.root.to_s}/../../examples/user_import_file_sample.tsv")
10
+ @file.default_user_group = UserGroup.find(2)
11
+ @file.default_library = Library.find(3)
10
12
  @file.user = users(:admin)
11
13
  @file.save
12
14
  end
@@ -21,39 +23,53 @@ describe UserImportFile do
21
23
  User.count.should eq old_users_count + 5
22
24
 
23
25
  user002 = User.where(:username => 'user002').first
24
- user002.user_number.should eq '001002'
25
- user002.user_group.name.should eq 'faculty'
26
- user002.expired_at.to_i.should eq Time.zone.parse('2013-12-01').end_of_day.to_i
26
+ user002.profile.user_group.name.should eq 'faculty'
27
+ user002.profile.expired_at.to_i.should eq Time.zone.parse('2013-12-01').end_of_day.to_i
27
28
  user002.valid_password?('4NsxXPLy')
28
- user002.user_number.should eq '001002'
29
- user002.library.name.should eq 'web'
30
- user002.locale.should eq 'en'
29
+ user002.profile.user_number.should eq '001002'
30
+ user002.profile.library.name.should eq 'hachioji'
31
+ user002.profile.locale.should eq 'en'
31
32
 
32
33
  user003 = User.where(:username => 'user003').first
33
- user003.note.should eq 'テストユーザ'
34
+ user003.profile.note.should eq 'テストユーザ'
34
35
  user003.role.name.should eq 'Librarian'
35
- user003.user_number.should eq '001003'
36
- user003.library.name.should eq 'kamata'
37
- user003.locale.should eq 'ja'
36
+ user003.profile.user_number.should eq '001003'
37
+ user003.profile.library.name.should eq 'kamata'
38
+ user003.profile.locale.should eq 'ja'
39
+ user003.profile.checkout_icalendar_token.should eq 'secrettoken'
40
+ user003.profile.save_checkout_history.should be_truthy
41
+ user003.profile.save_search_history.should be_falsy
42
+ user003.profile.share_bookmarks.should be_falsy
38
43
  User.where(:username => 'user000').first.should be_nil
39
44
  UserImportResult.count.should eq old_import_results_count + 6
40
45
 
41
- user005 = User.where(username: 'user005').first
46
+ user005 = User.where(:username => 'user005').first
42
47
  user005.role.name.should eq 'User'
43
- user005.library.name.should eq 'web'
44
- user005.locale.should eq 'en'
45
- user005.user_number.should eq '001005'
46
- user005.user_group.name.should eq 'faculty'
48
+ user005.profile.library.name.should eq 'hachioji'
49
+ user005.profile.locale.should eq 'en'
50
+ user005.profile.user_number.should eq '001005'
51
+ user005.profile.user_group.name.should eq 'faculty'
47
52
 
48
- user006 = User.where(username: 'user006').first
53
+ user006 = User.where(:username => 'user006').first
49
54
  user006.role.name.should eq 'User'
50
- user006.library.name.should eq 'web'
51
- user006.locale.should eq 'en'
52
- user006.user_number.should be_nil
53
- user006.user_group.name.should eq 'not_specified'
55
+ user006.profile.library.name.should eq 'hachioji'
56
+ user006.profile.locale.should eq 'en'
57
+ user006.profile.user_number.should be_nil
58
+ user006.profile.user_group.name.should eq UserGroup.find(2).name
54
59
 
55
60
  @file.user_import_fingerprint.should be_truthy
56
61
  @file.executed_at.should be_truthy
62
+
63
+ @file.reload
64
+ @file.error_message.should eq "The follwing column(s) were ignored: invalid"
65
+ end
66
+
67
+ it "should send message when import is completed" do
68
+ old_message_count = Message.count
69
+ @file.user = User.where(username: 'librarian1').first
70
+ @file.import_start
71
+ Message.count.should eq old_message_count + 1
72
+ Message.order(:id).last.subject.should eq 'インポートが完了しました'
57
73
  end
58
74
 
59
75
  it "should not import users that have higher roles than current user's role" do
@@ -77,6 +93,8 @@ describe UserImportFile do
77
93
  before(:each) do
78
94
  @file = UserImportFile.new :user_import => File.new("#{Rails.root.to_s}/../../examples/user_import_file_sample.tsv")
79
95
  @file.user = users(:admin)
96
+ @file.default_user_group = UserGroup.find(2)
97
+ @file.default_library = Library.find(3)
80
98
  @file.save
81
99
  @file.import_start
82
100
  end
@@ -92,6 +110,8 @@ describe UserImportFile do
92
110
  it "should import in background" do
93
111
  file = UserImportFile.new :user_import => File.new("#{Rails.root.to_s}/../../examples/user_import_file_sample.tsv")
94
112
  file.user = users(:admin)
113
+ file.default_user_group = UserGroup.find(2)
114
+ file.default_library = Library.find(3)
95
115
  file.save
96
116
  UserImportFileQueue.perform(file.id).should be_truthy
97
117
  end
@@ -115,4 +135,6 @@ end
115
135
  # created_at :datetime not null
116
136
  # updated_at :datetime not null
117
137
  # user_encoding :string(255)
138
+ # default_library_id :integer
139
+ # default_user_group_id :integer
118
140
  #
@@ -48,18 +48,6 @@ describe User do
48
48
  user.active_for_authentication?.should be_truthy
49
49
  end
50
50
 
51
- it 'should not set expired_at if its user group does not have valid period' do
52
- user = FactoryGirl.create(:user)
53
- user.expired_at.should be_nil
54
- end
55
-
56
- it 'should not set expired_at if its user group does not have valid period' do
57
- user = FactoryGirl.build(:user)
58
- user.user_group = FactoryGirl.create(:user_group, :valid_period_for_new_user => 10)
59
- user.save
60
- user.expired_at.should eq 10.days.from_now.end_of_day
61
- end
62
-
63
51
  it "should create user" do
64
52
  user = FactoryGirl.create(:user)
65
53
  assert !user.new_record?, "#{user.errors.full_messages.to_sentence}"
@@ -73,11 +61,6 @@ describe User do
73
61
  User.count.should eq old_count
74
62
  end
75
63
 
76
- it "should not require user_number" do
77
- user = FactoryGirl.create(:user, :user_number => nil)
78
- user.errors[:user_number].should be_empty
79
- end
80
-
81
64
  it "should require password" do
82
65
  user = FactoryGirl.build(:user, :password => nil)
83
66
  user.save
@@ -163,7 +146,7 @@ describe User do
163
146
  end
164
147
  end
165
148
 
166
- if defined?(EnjuMessage)
149
+ if defined?(EnjuCirculation)
167
150
  it "should send_message" do
168
151
  assert users(:librarian1).send_message('reservation_expired_for_patron', :manifestations => users(:librarian1).reserves.not_sent_expiration_notice_to_patron.collect(&:manifestation))
169
152
  users(:librarian1).reload