enju_biblio 0.1.3 → 0.2.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (342) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/app/controllers/agent_import_files_controller.rb +13 -3
  4. data/app/controllers/agent_import_results_controller.rb +12 -1
  5. data/app/controllers/agent_merge_lists_controller.rb +11 -1
  6. data/app/controllers/agent_merges_controller.rb +12 -2
  7. data/app/controllers/agent_relationship_types_controller.rb +13 -2
  8. data/app/controllers/agent_relationships_controller.rb +13 -4
  9. data/app/controllers/agent_types_controller.rb +13 -2
  10. data/app/controllers/agents_controller.rb +18 -12
  11. data/app/controllers/carrier_types_controller.rb +12 -2
  12. data/app/controllers/concerns/enju_biblio/controller.rb +99 -0
  13. data/app/controllers/content_types_controller.rb +12 -1
  14. data/app/controllers/countries_controller.rb +12 -1
  15. data/app/controllers/create_types_controller.rb +13 -2
  16. data/app/controllers/creates_controller.rb +13 -4
  17. data/app/controllers/donates_controller.rb +11 -1
  18. data/app/controllers/form_of_works_controller.rb +13 -2
  19. data/app/controllers/frequencies_controller.rb +13 -2
  20. data/app/controllers/identifier_types_controller.rb +13 -2
  21. data/app/controllers/import_requests_controller.rb +19 -9
  22. data/app/controllers/items_controller.rb +25 -13
  23. data/app/controllers/languages_controller.rb +12 -1
  24. data/app/controllers/licenses_controller.rb +13 -2
  25. data/app/controllers/manifestation_relationship_types_controller.rb +12 -1
  26. data/app/controllers/manifestation_relationships_controller.rb +13 -4
  27. data/app/controllers/manifestations_controller.rb +58 -30
  28. data/app/controllers/medium_of_performances_controller.rb +13 -2
  29. data/app/controllers/owns_controller.rb +12 -3
  30. data/app/controllers/picture_files_controller.rb +13 -3
  31. data/app/controllers/produce_types_controller.rb +13 -2
  32. data/app/controllers/produces_controller.rb +13 -4
  33. data/app/controllers/realize_types_controller.rb +13 -2
  34. data/app/controllers/realizes_controller.rb +13 -4
  35. data/app/controllers/resource_export_files_controller.rb +13 -3
  36. data/app/controllers/resource_import_files_controller.rb +14 -4
  37. data/app/controllers/resource_import_results_controller.rb +12 -1
  38. data/app/controllers/series_statement_merge_lists_controller.rb +11 -1
  39. data/app/controllers/series_statement_merges_controller.rb +12 -2
  40. data/app/controllers/series_statements_controller.rb +13 -5
  41. data/app/helpers/manifestations_helper.rb +8 -8
  42. data/app/jobs/agent_import_file_job.rb +7 -0
  43. data/app/jobs/resource_export_file_job.rb +7 -0
  44. data/app/jobs/resource_import_file_job.rb +7 -0
  45. data/app/models/agent.rb +23 -1
  46. data/app/models/agent_import_file.rb +0 -1
  47. data/app/models/carrier_type.rb +0 -1
  48. data/app/models/identifier.rb +1 -1
  49. data/app/models/item.rb +2 -9
  50. data/app/models/manifestation.rb +180 -75
  51. data/app/models/picture_file.rb +1 -1
  52. data/app/models/resource_export_file.rb +5 -3
  53. data/app/models/resource_import_file.rb +34 -50
  54. data/app/models/series_statement.rb +8 -1
  55. data/app/policies/agent_import_file_policy.rb +21 -0
  56. data/app/policies/agent_import_result_policy.rb +21 -0
  57. data/app/policies/agent_merge_list_policy.rb +25 -0
  58. data/app/policies/agent_merge_policy.rb +25 -0
  59. data/app/policies/agent_policy.rb +30 -0
  60. data/app/policies/agent_relationship_policy.rb +21 -0
  61. data/app/policies/agent_relationship_type_policy.rb +21 -0
  62. data/app/policies/agent_type_policy.rb +23 -0
  63. data/app/policies/carrier_type_policy.rb +23 -0
  64. data/app/policies/content_type_policy.rb +23 -0
  65. data/app/policies/country_policy.rb +21 -0
  66. data/app/policies/create_policy.rb +21 -0
  67. data/app/policies/create_type_policy.rb +21 -0
  68. data/app/policies/donate_policy.rb +21 -0
  69. data/app/policies/form_of_work_policy.rb +21 -0
  70. data/app/policies/frequency_policy.rb +23 -0
  71. data/app/policies/identifier_type_policy.rb +23 -0
  72. data/app/policies/import_request_policy.rb +21 -0
  73. data/app/policies/item_policy.rb +27 -0
  74. data/app/policies/language_policy.rb +21 -0
  75. data/app/policies/license_policy.rb +21 -0
  76. data/app/policies/manifestation_policy.rb +67 -0
  77. data/app/policies/manifestation_relationship_policy.rb +21 -0
  78. data/app/policies/manifestation_relationship_type_policy.rb +21 -0
  79. data/app/policies/medium_of_performance_policy.rb +21 -0
  80. data/app/policies/own_policy.rb +21 -0
  81. data/app/policies/picture_file_policy.rb +32 -0
  82. data/app/policies/produce_policy.rb +21 -0
  83. data/app/policies/produce_type_policy.rb +21 -0
  84. data/app/policies/realize_policy.rb +21 -0
  85. data/app/policies/realize_type_policy.rb +21 -0
  86. data/app/policies/resource_export_file_policy.rb +21 -0
  87. data/app/policies/resource_import_file_policy.rb +21 -0
  88. data/app/policies/resource_import_result_policy.rb +21 -0
  89. data/app/policies/series_statement_merge_list_policy.rb +25 -0
  90. data/app/policies/series_statement_merge_policy.rb +25 -0
  91. data/app/policies/series_statement_policy.rb +25 -0
  92. data/app/views/agent_relationship_types/index.html.erb +4 -4
  93. data/app/views/agent_types/index.html.erb +4 -4
  94. data/app/views/agent_types/show.html.erb +1 -1
  95. data/app/views/agents/_agent.html.erb +2 -2
  96. data/app/views/agents/_index.html.erb +1 -1
  97. data/app/views/agents/_index_agent.html.erb +4 -4
  98. data/app/views/agents/_index_agent_merge_list.html.erb +2 -2
  99. data/app/views/agents/_index_expression.html.erb +3 -3
  100. data/app/views/agents/_index_manifestation.html.erb +3 -3
  101. data/app/views/agents/_index_work.html.erb +3 -3
  102. data/app/views/agents/edit.html.erb +1 -1
  103. data/app/views/agents/{index.mobile.erb → index.html+phone.erb} +0 -0
  104. data/app/views/agents/index.json.jbuilder +5 -0
  105. data/app/views/agents/index.rss.builder +2 -2
  106. data/app/views/agents/{show.mobile.erb → show.html+phone.erb} +0 -0
  107. data/app/views/agents/show.html.erb +3 -3
  108. data/app/views/carrier_types/_form.html.erb +1 -1
  109. data/app/views/carrier_types/index.html.erb +4 -4
  110. data/app/views/carrier_types/show.html.erb +1 -1
  111. data/app/views/content_types/index.html.erb +4 -4
  112. data/app/views/content_types/show.html.erb +1 -1
  113. data/app/views/countries/index.html.erb +3 -3
  114. data/app/views/countries/show.html.erb +1 -1
  115. data/app/views/create_types/index.html.erb +4 -4
  116. data/app/views/creates/_index.html.erb +2 -2
  117. data/app/views/creates/_index_agent.html.erb +3 -3
  118. data/app/views/creates/_index_work.html.erb +2 -2
  119. data/app/views/donates/index.html.erb +2 -2
  120. data/app/views/form_of_works/index.html.erb +4 -4
  121. data/app/views/form_of_works/show.html.erb +1 -1
  122. data/app/views/frequencies/index.html.erb +4 -4
  123. data/app/views/frequencies/show.html.erb +1 -1
  124. data/app/views/identifier_types/index.html.erb +4 -4
  125. data/app/views/identifier_types/show.html.erb +1 -1
  126. data/app/views/import_requests/index.html.erb +1 -1
  127. data/app/views/items/{_shelf_picture.mobile.erb → _shelf_picture.html+phone.erb} +0 -0
  128. data/app/views/items/edit.html.erb +2 -2
  129. data/app/views/items/{index.mobile.erb → index.html+phone.erb} +1 -1
  130. data/app/views/items/index.html.erb +2 -2
  131. data/app/views/items/new.html.erb +1 -5
  132. data/app/views/items/{show.mobile.erb → show.html+phone.erb} +0 -0
  133. data/app/views/items/show.html.erb +10 -6
  134. data/app/views/languages/index.html.erb +3 -3
  135. data/app/views/languages/show.html.erb +1 -1
  136. data/app/views/layouts/{agents.mobile.erb → agents.html+phone.erb} +1 -1
  137. data/app/views/layouts/agents.html.erb +2 -2
  138. data/app/views/layouts/{manifestations.mobile.erb → manifestations.html+phone.erb} +1 -1
  139. data/app/views/layouts/manifestations.html.erb +2 -2
  140. data/app/views/licenses/index.html.erb +4 -4
  141. data/app/views/manifestation_relationship_types/index.html.erb +4 -4
  142. data/app/views/manifestations/_attachment_file.html.erb +1 -1
  143. data/app/views/manifestations/_carrier_type_facet.html.erb +1 -1
  144. data/app/views/manifestations/_classification_facet.html.erb +2 -2
  145. data/app/views/manifestations/_contributor_fields.html.erb +4 -0
  146. data/app/views/manifestations/_creator_fields.html.erb +5 -0
  147. data/app/views/manifestations/_edit_detail.html.erb +1 -1
  148. data/app/views/manifestations/_export_list.html.erb +3 -3
  149. data/app/views/manifestations/_form.html.erb +25 -30
  150. data/app/views/manifestations/_holding.html.erb +6 -8
  151. data/app/views/manifestations/_identifier_fields.html.erb +5 -0
  152. data/app/views/manifestations/_index_form_contributor.html.erb +2 -2
  153. data/app/views/manifestations/_index_form_creator.html.erb +2 -2
  154. data/app/views/manifestations/_index_form_item.html.erb +2 -2
  155. data/app/views/manifestations/_index_form_manifestation.html.erb +2 -2
  156. data/app/views/manifestations/_index_form_parent.html.erb +1 -1
  157. data/app/views/manifestations/_index_form_publisher.html.erb +2 -2
  158. data/app/views/manifestations/_index_form_series_statement.html.erb +2 -2
  159. data/app/views/manifestations/_language_facet.html.erb +1 -1
  160. data/app/views/manifestations/_library_facet.html.erb +1 -1
  161. data/app/views/manifestations/_manifestation.html.erb +6 -2
  162. data/app/views/manifestations/_manifestation.txt.erb +1 -1
  163. data/app/views/manifestations/_paginate_id_store.html.erb +8 -6
  164. data/app/views/manifestations/_pub_year_facet.html.erb +1 -1
  165. data/app/views/manifestations/_publisher_fields.html.erb +4 -0
  166. data/app/views/manifestations/_reservable_facet.html.erb +2 -2
  167. data/app/views/manifestations/_series_statement_fields.html.erb +13 -0
  168. data/app/views/manifestations/_show.rdf.builder +3 -87
  169. data/app/views/manifestations/{_show_creators.mobile.erb → _show_creators.html+phone.erb} +0 -0
  170. data/app/views/manifestations/_show_creators.html.erb +0 -1
  171. data/app/views/manifestations/_show_detail_librarian.html.erb +20 -22
  172. data/app/views/manifestations/_show_detail_user.html.erb +13 -15
  173. data/app/views/manifestations/{_show_holding.mobile.erb → _show_holding.html+phone.erb} +0 -0
  174. data/app/views/manifestations/_show_holding.html.erb +1 -1
  175. data/app/views/manifestations/{_show_index.mobile.erb → _show_index.html+phone.erb} +0 -0
  176. data/app/views/manifestations/_submenu_parent.html.erb +3 -3
  177. data/app/views/manifestations/{_title.mobile.erb → _title.html+phone.erb} +0 -0
  178. data/app/views/manifestations/edit.html.erb +2 -6
  179. data/app/views/manifestations/{index.mobile.erb → index.html+phone.erb} +0 -0
  180. data/app/views/manifestations/index.html.erb +40 -24
  181. data/app/views/manifestations/index.rdf.builder +5 -3
  182. data/app/views/manifestations/index.rss.builder +2 -2
  183. data/app/views/manifestations/index.txt.erb +1 -2
  184. data/app/views/manifestations/{show.mobile.erb → show.html+phone.erb} +1 -1
  185. data/app/views/manifestations/show.html.erb +1 -1
  186. data/app/views/manifestations/show.txt.erb +1 -2
  187. data/app/views/medium_of_performances/index.html.erb +4 -4
  188. data/app/views/owns/index.html.erb +2 -2
  189. data/app/views/picture_files/_index.html.erb +3 -3
  190. data/app/views/picture_files/_index_agent.html.erb +4 -4
  191. data/app/views/picture_files/_index_manifestation.html.erb +4 -4
  192. data/app/views/picture_files/{_link.mobile.erb → _link.html+phone.erb} +0 -0
  193. data/app/views/picture_files/{show.mobile.erb → show.html+phone.erb} +0 -0
  194. data/app/views/produce_types/index.html.erb +4 -4
  195. data/app/views/produces/_index.html.erb +2 -2
  196. data/app/views/produces/_index_agent.html.erb +2 -2
  197. data/app/views/produces/_index_manifestation.html.erb +2 -2
  198. data/app/views/realize_types/index.html.erb +4 -4
  199. data/app/views/realizes/_index.html.erb +2 -2
  200. data/app/views/realizes/_index_agent.html.erb +2 -2
  201. data/app/views/realizes/_index_expression.html.erb +2 -2
  202. data/app/views/series_statement_merges/show.html.erb +0 -2
  203. data/app/views/series_statements/_index.html.erb +4 -4
  204. data/app/views/series_statements/_index_series_statement_merge_list.html.erb +2 -2
  205. data/app/views/series_statements/show.html.erb +1 -1
  206. data/config/locales/translation_en.yml +13 -0
  207. data/config/locales/translation_ja.yml +13 -0
  208. data/config/routes.rb +3 -43
  209. data/lib/enju_biblio/engine.rb +0 -1
  210. data/lib/enju_biblio/version.rb +1 -1
  211. data/lib/enju_biblio.rb +0 -107
  212. data/lib/tasks/enju_biblio_tasks.rake +1 -1
  213. data/spec/cassette_library/ImportRequest/import/should_import_bibliographic_record.yml +43 -43
  214. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_isbn_which_is_already_imported/redirects_to_the_created_import_request.yml +45 -45
  215. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/assigns_a_newly_created_import_request_as_import_request.yml +50 -50
  216. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/redirects_to_the_created_import_request.yml +44 -44
  217. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/assigns_a_newly_created_import_request_as_import_request.yml +48 -48
  218. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/redirects_to_the_created_import_request.yml +41 -41
  219. data/spec/cassette_library/ResourceImportFile/should_import_in_background.yml +50 -50
  220. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/ISBN_import/with_record_not_found/should_record_an_error_message.yml +49 -49
  221. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_has_only_isbn/should_be_imported.yml +45 -45
  222. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_shift_jis/should_be_imported.yml +50 -50
  223. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_be_imported.yml +48 -48
  224. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_be_searchable_right_after_the_import.yml +512 -0
  225. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_send_message_when_import_is_completed.yml +42 -42
  226. data/spec/controllers/agent_import_files_controller_spec.rb +5 -5
  227. data/spec/controllers/agent_import_results_controller_spec.rb +3 -3
  228. data/spec/controllers/agent_merge_lists_controller_spec.rb +9 -9
  229. data/spec/controllers/agent_merges_controller_spec.rb +9 -9
  230. data/spec/controllers/agent_relationship_types_controller_spec.rb +14 -14
  231. data/spec/controllers/agent_relationships_controller_spec.rb +9 -9
  232. data/spec/controllers/agent_types_controller_spec.rb +2 -2
  233. data/spec/controllers/agents_controller_spec.rb +8 -8
  234. data/spec/controllers/carrier_types_controller_spec.rb +1 -1
  235. data/spec/controllers/content_types_controller_spec.rb +1 -1
  236. data/spec/controllers/countries_controller_spec.rb +10 -10
  237. data/spec/controllers/create_types_controller_spec.rb +2 -2
  238. data/spec/controllers/creates_controller_spec.rb +7 -7
  239. data/spec/controllers/donates_controller_spec.rb +9 -9
  240. data/spec/controllers/form_of_works_controller_spec.rb +2 -2
  241. data/spec/controllers/frequencies_controller_spec.rb +2 -2
  242. data/spec/controllers/identifier_types_controller_spec.rb +2 -2
  243. data/spec/controllers/import_requests_controller_spec.rb +9 -9
  244. data/spec/controllers/items_controller_spec.rb +13 -7
  245. data/spec/controllers/languages_controller_spec.rb +8 -8
  246. data/spec/controllers/licenses_controller_spec.rb +2 -2
  247. data/spec/controllers/manifestation_relationship_types_controller_spec.rb +10 -10
  248. data/spec/controllers/manifestation_relationships_controller_spec.rb +9 -9
  249. data/spec/controllers/manifestations_controller_spec.rb +86 -12
  250. data/spec/controllers/medium_of_performances_controller_spec.rb +2 -2
  251. data/spec/controllers/owns_controller_spec.rb +7 -7
  252. data/spec/controllers/picture_files_controller_spec.rb +9 -9
  253. data/spec/controllers/produce_types_controller_spec.rb +2 -2
  254. data/spec/controllers/produces_controller_spec.rb +7 -7
  255. data/spec/controllers/realize_types_controller_spec.rb +2 -2
  256. data/spec/controllers/realizes_controller_spec.rb +7 -7
  257. data/spec/controllers/resource_export_files_controller_spec.rb +9 -15
  258. data/spec/controllers/resource_import_files_controller_spec.rb +7 -7
  259. data/spec/controllers/resource_import_results_controller_spec.rb +3 -3
  260. data/spec/controllers/series_statement_merge_lists_controller_spec.rb +9 -9
  261. data/spec/controllers/series_statement_merges_controller_spec.rb +9 -9
  262. data/spec/controllers/series_statements_controller_spec.rb +7 -7
  263. data/spec/dummy/app/assets/javascripts/application.js +0 -2
  264. data/spec/dummy/app/controllers/application_controller.rb +10 -6
  265. data/spec/dummy/app/models/user.rb +4 -4
  266. data/spec/dummy/config/application.rb +13 -41
  267. data/spec/dummy/config/environments/development.rb +22 -18
  268. data/spec/dummy/config/environments/production.rb +46 -34
  269. data/spec/dummy/config/environments/test.rb +19 -14
  270. data/spec/dummy/config/initializers/assets.rb +1 -1
  271. data/spec/dummy/config/initializers/enju_leaf.rb +8 -0
  272. data/spec/dummy/config/routes.rb +3 -0
  273. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
  274. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  275. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  276. data/spec/dummy/db/schema.rb +27 -2
  277. data/spec/factories/classification_type.rb +5 -0
  278. data/spec/factories/reserve.rb +12 -0
  279. data/spec/factories/role.rb +9 -0
  280. data/spec/factories/subject.rb +7 -0
  281. data/spec/factories/subject_heading_type.rb +5 -0
  282. data/spec/factories/subject_heading_type_has_subject.rb +6 -0
  283. data/spec/factories/subject_type.rb +5 -0
  284. data/spec/fixtures/checked_items.yml +4 -4
  285. data/spec/fixtures/checkouts.yml +12 -12
  286. data/spec/fixtures/classification_types.yml +1 -1
  287. data/spec/fixtures/classifications.yml +1 -0
  288. data/spec/fixtures/manifestations.yml +4 -4
  289. data/spec/fixtures/reserves.yml +16 -16
  290. data/spec/fixtures/subjects.yml +79 -0
  291. data/spec/models/agent_import_file_spec.rb +1 -1
  292. data/spec/models/manifestation_spec.rb +27 -13
  293. data/spec/models/resource_export_file_spec.rb +15 -2
  294. data/spec/models/resource_import_file_spec.rb +29 -9
  295. data/spec/models/series_statement_merge_list_spec.rb +1 -1
  296. data/spec/policies/manifestation_policy_spec.rb +24 -0
  297. data/spec/rails_helper.rb +82 -0
  298. data/spec/spec_helper.rb +81 -56
  299. data/spec/support/devise.rb +2 -2
  300. data/spec/support/vcr.rb +8 -0
  301. data/spec/views/agent_types/index.html.erb_spec.rb +2 -1
  302. data/spec/views/agent_types/show.html.erb_spec.rb +1 -0
  303. data/spec/views/create_types/index.html.erb_spec.rb +2 -1
  304. data/spec/views/creates/edit.html.erb_spec.rb +0 -3
  305. data/spec/views/creates/index.html.erb_spec.rb +2 -4
  306. data/spec/views/creates/new.html.erb_spec.rb +0 -3
  307. data/spec/views/creates/show.html.erb_spec.rb +0 -3
  308. data/spec/views/import_requests/index.html.erb_spec.rb +3 -2
  309. data/spec/views/manifestations/index.html.erb_spec.rb +25 -0
  310. data/spec/views/manifestations/index.rdf.builder_spec.rb +23 -0
  311. data/spec/views/manifestations/index.txt.erb_spec.rb +17 -0
  312. data/spec/views/manifestations/show.html.erb_spec.rb +2 -3
  313. data/spec/views/manifestations/show.txt.erb_spec.rb +16 -0
  314. data/spec/views/owns/edit.html.erb_spec.rb +0 -3
  315. data/spec/views/owns/index.html.erb_spec.rb +2 -4
  316. data/spec/views/owns/new.html.erb_spec.rb +0 -3
  317. data/spec/views/owns/show.html.erb_spec.rb +0 -3
  318. data/spec/views/produce_types/index.html.erb_spec.rb +2 -1
  319. data/spec/views/produces/edit.html.erb_spec.rb +0 -3
  320. data/spec/views/produces/index.html.erb_spec.rb +2 -4
  321. data/spec/views/produces/new.html.erb_spec.rb +0 -3
  322. data/spec/views/produces/show.html.erb_spec.rb +0 -3
  323. data/spec/views/realize_types/index.html.erb_spec.rb +2 -1
  324. data/spec/views/realizes/edit.html.erb_spec.rb +0 -3
  325. data/spec/views/realizes/index.html.erb_spec.rb +2 -4
  326. data/spec/views/realizes/new.html.erb_spec.rb +0 -3
  327. data/spec/views/realizes/show.html.erb_spec.rb +0 -3
  328. data/spec/views/resource_import_files/index.html.erb_spec.rb +0 -3
  329. data/spec/views/resource_import_files/{show.html.erb_spec.erb → show.html.erb_spec.rb} +0 -3
  330. data/spec/views/resource_import_results/index.html.erb_spec.rb +0 -3
  331. data/spec/views/resource_import_results/{show.html.erb_spec.erb → show.html.erb_spec.rb} +1 -4
  332. data/spec/views/series_statement_merge_lists/index.html.erb_spec.rb +1 -1
  333. data/spec/views/series_statement_merges/edit.html.erb_spec.rb +0 -3
  334. data/spec/views/series_statement_merges/index.html.erb_spec.rb +0 -3
  335. data/spec/views/series_statement_merges/new.html.erb_spec.rb +0 -3
  336. data/spec/views/series_statement_merges/show.html.erb_spec.rb +0 -3
  337. metadata +170 -131
  338. data/app/models/enju_biblio/ability.rb +0 -238
  339. data/app/workers/agent_import_file_queue.rb +0 -7
  340. data/app/workers/resource_export_file_queue.rb +0 -7
  341. data/app/workers/resource_import_file_queue.rb +0 -7
  342. data/spec/dummy/config/application.yml +0 -42
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe ResourceImportFile do
5
5
  fixtures :all
@@ -16,7 +16,7 @@ describe ResourceImportFile do
16
16
  old_items_count = Item.count
17
17
  old_agents_count = Agent.count
18
18
  old_import_results_count = ResourceImportResult.count
19
- @file.import_start.should eq({:manifestation_imported => 9, :item_imported => 8, :manifestation_found => 5, :item_found => 3, :failed => 7})
19
+ @file.import_start.should eq({:manifestation_imported => 9, :item_imported => 9, :manifestation_found => 6, :item_found => 3, :failed => 7})
20
20
  manifestation = Item.where(item_identifier: '11111').first.manifestation
21
21
  manifestation.publishers.first.full_name.should eq 'test4'
22
22
  manifestation.publishers.first.full_name_transcription.should eq 'てすと4'
@@ -25,10 +25,10 @@ describe ResourceImportFile do
25
25
  manifestation.creates.first.create_type.name.should eq 'author'
26
26
  manifestation.identifier_contents(:issn).should eq ['03875806']
27
27
  Manifestation.count.should eq old_manifestations_count + 9
28
- Item.count.should eq old_items_count + 8
28
+ Item.count.should eq old_items_count + 9
29
29
  Agent.count.should eq old_agents_count + 9
30
30
  @file.resource_import_results.order(:id).first.body.split("\t").first.should eq 'manifestation_identifier'
31
- ResourceImportResult.count.should eq old_import_results_count + 21
31
+ ResourceImportResult.count.should eq old_import_results_count + 22
32
32
 
33
33
  manifestation_101 = Manifestation.where(manifestation_identifier: '101').first
34
34
  manifestation_101.series_statements.count.should eq 1
@@ -36,6 +36,7 @@ describe ResourceImportFile do
36
36
  manifestation_101.series_statements.first.title_transcription.should eq 'しゅしりーず'
37
37
  manifestation_101.series_statements.first.title_subseries.should eq '副シリーズ'
38
38
  manifestation_101.series_statements.first.title_subseries_transcription.should eq 'ふくしりーず'
39
+ manifestation_101.items.order(:id).last.call_number.should eq '007|A'
39
40
 
40
41
  item_10101 = Item.where(item_identifier: '10101').first
41
42
  item_10101.manifestation.creators.size.should eq 2
@@ -46,7 +47,7 @@ describe ResourceImportFile do
46
47
  item_10101.budget_type.name.should eq 'Public fund'
47
48
  item_10101.bookstore.name.should eq 'Example store'
48
49
  item_10101.manifestation.classifications.count.should eq 1
49
- item_10101.manifestation.classifications.first.classification_type.name.should eq 'ndc'
50
+ item_10101.manifestation.classifications.first.classification_type.name.should eq 'ndc9'
50
51
  item_10101.manifestation.classifications.first.category.should eq '007'
51
52
  item_10101.manifestation.language.name.should eq 'Japanese'
52
53
  item_10101.manifestation.statement_of_responsibility.should eq '著者A; 著者B'
@@ -104,7 +105,7 @@ describe ResourceImportFile do
104
105
  item_10104.manifestation.width.should be_nil
105
106
  item_10104.manifestation.depth.should be_nil
106
107
  item_10104.manifestation.subjects.order(:id).map{|s| {s.subject_heading_type.name => s.term}}.should eq [{"ndlsh" => "コンピュータ"}, {"ndlsh" => "図書館"}]
107
- item_10104.manifestation.classifications.order(:id).map{|c| {c.classification_type.name => c.category}}.should eq [{"ndc" => "007"}, {"ddc" => "003"}, {"ddc" => "004"}]
108
+ item_10104.manifestation.classifications.order(:id).map{|c| {c.classification_type.name => c.category}}.should eq [{"ndc9" => "007"}, {"ddc" => "003"}, {"ddc" => "004"}]
108
109
 
109
110
  manifestation_104 = Manifestation.where(manifestation_identifier: '104').first
110
111
  manifestation_104.identifier_contents(:isbn).should eq ['9784797327038']
@@ -112,7 +113,7 @@ describe ResourceImportFile do
112
113
  manifestation_104.creators.collect(&:full_name).should eq ['test3']
113
114
  manifestation_104.publishers.collect(&:full_name).should eq ['test4']
114
115
 
115
- ResourceImportResult.where(manifestation_id: manifestation_101.id).order(:id).last.error_message.should eq "line 8: #{I18n.t('import.manifestation_found')}"
116
+ ResourceImportResult.where(manifestation_id: manifestation_101.id).order(:id).last.error_message.should eq "line 22: #{I18n.t('import.manifestation_found')}"
116
117
  ResourceImportResult.where(item_id: item_10101.id).order(:id).last.error_message.should eq "line 9: #{I18n.t('import.item_found')}"
117
118
 
118
119
  Item.where(item_identifier: '11113').first.manifestation.original_title.should eq 'test10'
@@ -132,7 +133,7 @@ describe ResourceImportFile do
132
133
  Message.order(:id).last.subject.should eq 'インポートが完了しました'
133
134
  end
134
135
 
135
- it "should be searchable right after the import", solr: true do
136
+ it "should be searchable right after the import", solr: true, vcr: true do
136
137
  @file.import_start
137
138
  Manifestation.search{ keywords "10101" }.total.should > 0
138
139
  Manifestation.search{ keywords "10101", :fields => [:item_identifier] }.total.should > 0
@@ -225,6 +226,25 @@ describe ResourceImportFile do
225
226
  Manifestation.order(:id).last.publication_place.should eq '東京'
226
227
  end
227
228
  end
229
+
230
+ describe "when it contains item related fields" do
231
+ it "should create an item as well" do
232
+ import_file = <<-EOF
233
+ original_title call_number item_note
234
+ resource_import_file_test1 007.6 note for the item.
235
+ EOF
236
+ file = ResourceImportFile.create(resource_import: StringIO.new(import_file))
237
+ file.user = users(:admin)
238
+ old_manifestations_count = Manifestation.count
239
+ old_items_count = Item.count
240
+ result = file.import_start
241
+ expect(Manifestation.count).to eq old_manifestations_count + 1
242
+ expect(Item.count).to eq old_items_count + 1
243
+ expect(file.resource_import_results.last.item).to be_valid
244
+ expect(file.resource_import_results.last.item.call_number).to eq "007.6"
245
+ expect(file.resource_import_results.last.item.note).to eq "note for the item."
246
+ end
247
+ end
228
248
  end
229
249
 
230
250
  describe "when its mode is 'update'" do
@@ -286,7 +306,7 @@ describe ResourceImportFile do
286
306
  file = ResourceImportFile.create resource_import: File.new("#{Rails.root.to_s}/../../examples/resource_import_file_sample1.tsv")
287
307
  file.user = users(:admin)
288
308
  file.save
289
- ResourceImportFileQueue.perform(file.id).should be_truthy
309
+ ResourceImportFileJob.perform_later(file).should be_truthy
290
310
  end
291
311
  end
292
312
 
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe SeriesStatementMergeList do
4
4
  fixtures :all
5
5
 
6
- it "should merge series_statment" do
6
+ it "should merge series_statement" do
7
7
  series_statement_merge_list = series_statement_merge_lists(:series_statement_merge_list_00001)
8
8
  end
9
9
  end
@@ -0,0 +1,24 @@
1
+ require "rails_helper"
2
+
3
+ describe ManifestationPolicy do
4
+ subject { described_class }
5
+ permissions :destroy? do
6
+ before(:each) do
7
+ @admin = FactoryGirl.create(:admin)
8
+ end
9
+ it "grants destroy if it is a simple record." do
10
+ record = FactoryGirl.create(:manifestation)
11
+ expect(subject).to permit(@admin, record)
12
+ end
13
+ it "not grants destroy if it is reserved" do
14
+ record = FactoryGirl.create(:manifestation)
15
+ reserve = FactoryGirl.create(:reserve, manifestation_id: record.id)
16
+ expect(subject).not_to permit(@admin, record)
17
+ end
18
+ it "grants destroy if it is a simple serial record." do
19
+ record = FactoryGirl.create(:manifestation_serial)
20
+ policy = Pundit.policy(@admin, record)
21
+ expect(subject).to permit(@admin, record)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,82 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ SimpleCov.start 'rails'
4
+ Coveralls.wear!
5
+
6
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
7
+ ENV['RAILS_ENV'] ||= 'test'
8
+ require File.expand_path('../../spec/dummy/config/environment', __FILE__)
9
+ # Prevent database truncation if the environment is production
10
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
11
+ require 'spec_helper'
12
+ require 'rspec/rails'
13
+ # Add additional requires below this line. Rails is not loaded until this point!
14
+ require 'vcr'
15
+ require 'factory_girl'
16
+ require 'sunspot-rails-tester'
17
+ require 'rspec/active_model/mocks'
18
+ require 'pundit/rspec'
19
+ require "capybara/rspec"
20
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
21
+
22
+ # Requires supporting ruby files with custom matchers and macros, etc, in
23
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
24
+ # run as spec files by default. This means that files in spec/support that end
25
+ # in _spec.rb will both be required and run as specs, causing the specs to be
26
+ # run twice. It is recommended that you do not name files matching this glob to
27
+ # end with _spec.rb. You can configure this pattern with the --pattern
28
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
29
+ #
30
+ # The following line is provided for convenience purposes. It has the downside
31
+ # of increasing the boot-up time by auto-requiring all files in the support
32
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
33
+ # require only the support files necessary.
34
+ #
35
+ # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
36
+
37
+ # Checks for pending migrations before tests are run.
38
+ # If you are not using ActiveRecord, you can remove this line.
39
+ ActiveRecord::Migration.maintain_test_schema! if Rails::VERSION::MAJOR >= 4
40
+
41
+ RSpec.configure do |config|
42
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
43
+ config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
44
+
45
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
46
+ # examples within a transaction, remove the following line or assign false
47
+ # instead of true.
48
+ config.use_transactional_fixtures = true
49
+
50
+ # RSpec Rails can automatically mix in different behaviours to your tests
51
+ # based on their file location, for example enabling you to call `get` and
52
+ # `post` in specs under `spec/controllers`.
53
+ #
54
+ # You can disable this behaviour by removing the line below, and instead
55
+ # explicitly tag your specs with their type, e.g.:
56
+ #
57
+ # RSpec.describe UsersController, :type => :controller do
58
+ # # ...
59
+ # end
60
+ #
61
+ # The different available types are documented in the features, such as in
62
+ # https://relishapp.com/rspec/rspec-rails/docs
63
+ config.infer_spec_type_from_file_location!
64
+
65
+ config.extend ControllerMacros, :type => :controller
66
+
67
+ $original_sunspot_session = Sunspot.session
68
+
69
+ config.before do
70
+ Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
71
+ end
72
+
73
+ config.before :each, :solr => true do
74
+ Sunspot::Rails::Tester.start_original_sunspot_session
75
+ Sunspot.session = $original_sunspot_session
76
+ Sunspot.remove_all!
77
+ end
78
+ end
79
+
80
+ FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
81
+ FactoryGirl.find_definitions
82
+
data/spec/spec_helper.rb CHANGED
@@ -1,67 +1,92 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
- SimpleCov.start 'rails'
4
- Coveralls.wear!
5
-
6
- # This file is copied to spec/ when you run 'rails generate rspec:install'
7
- ENV["RAILS_ENV"] ||= 'test'
8
- ENV["SOLR_URL"] ||= 'http://localhost:8981/solr/test'
9
- require File.expand_path("../../spec/dummy/config/environment", __FILE__)
10
- require 'rspec/rails'
11
- require 'vcr'
12
- require 'factory_girl'
13
- require 'sunspot-rails-tester'
14
- require 'rspec/active_model/mocks'
15
-
16
- # Requires supporting ruby files with custom matchers and macros, etc,
17
- # in spec/support/ and its subdirectories.
18
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
19
-
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
20
19
  RSpec.configure do |config|
21
- # ## Mock Framework
22
- #
23
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
24
- #
25
- # config.mock_with :mocha
26
- # config.mock_with :flexmock
27
- # config.mock_with :rr
28
-
29
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
30
- config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
31
-
32
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
33
- # examples within a transaction, remove the following line or assign false
34
- # instead of true.
35
- config.use_transactional_fixtures = true
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
36
33
 
37
- # If true, the base class of anonymous controllers will be inferred
38
- # automatically. This will be the default behavior in future versions of
39
- # rspec-rails.
40
- config.infer_base_class_for_anonymous_controllers = false
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = false
41
+ end
41
42
 
42
- config.extend ControllerMacros, :type => :controller
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
43
52
 
44
- $original_sunspot_session = Sunspot.session
53
+ # Allows RSpec to persist some state between runs in order to support
54
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
55
+ # you configure your source control system to ignore this file.
56
+ config.example_status_persistence_file_path = "spec/examples.txt"
45
57
 
46
- config.before do
47
- Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
48
- end
58
+ # Limits the available syntax to the non-monkey patched syntax that is
59
+ # recommended. For more details, see:
60
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
61
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
63
+ config.disable_monkey_patching!
49
64
 
50
- config.before :each, :solr => true do
51
- Sunspot::Rails::Tester.start_original_sunspot_session
52
- Sunspot.session = $original_sunspot_session
53
- Sunspot.remove_all!
65
+ # Many RSpec users commonly either run the entire suite or an individual
66
+ # file, and it's useful to allow more verbose output when running an
67
+ # individual spec file.
68
+ if config.files_to_run.one?
69
+ # Use the documentation formatter for detailed output,
70
+ # unless a formatter has already been configured
71
+ # (e.g. via a command-line flag).
72
+ config.default_formatter = 'doc'
54
73
  end
55
74
 
56
- config.infer_spec_type_from_file_location!
57
- end
75
+ # Print the 10 slowest examples and example groups at the
76
+ # end of the spec run, to help surface which specs are running
77
+ # particularly slow.
78
+ config.profile_examples = 10
58
79
 
59
- FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
60
- FactoryGirl.find_definitions
80
+ # Run specs in random order to surface order dependencies. If you find an
81
+ # order dependency and want to debug it, you can fix the order by providing
82
+ # the seed, which is printed after each run.
83
+ # --seed 1234
84
+ config.order = :random
61
85
 
62
- VCR.configure do |c|
63
- c.cassette_library_dir = 'spec/cassette_library'
64
- c.hook_into :webmock
65
- c.configure_rspec_metadata!
66
- c.allow_http_connections_when_no_cassette = true
86
+ # Seed global randomization in this process using the `--seed` CLI option.
87
+ # Setting this allows you to use `--seed` to deterministically reproduce
88
+ # test failures related to randomization by passing the same `--seed` value
89
+ # as the one that triggered the failure.
90
+ Kernel.srand config.seed
91
+ =end
67
92
  end
@@ -1,4 +1,4 @@
1
1
  RSpec.configure do |config|
2
- config.include Devise::TestHelpers, :type => :controller
3
- config.include Devise::TestHelpers, :type => :view
2
+ config.include Devise::Test::ControllerHelpers, type: :controller
3
+ config.include Devise::Test::ControllerHelpers, type: :view
4
4
  end
@@ -0,0 +1,8 @@
1
+ VCR.configure do |c|
2
+ c.cassette_library_dir = 'spec/cassette_library'
3
+ c.hook_into :webmock
4
+ c.configure_rspec_metadata!
5
+ c.allow_http_connections_when_no_cassette = true
6
+ c.ignore_localhost = true
7
+ end
8
+
@@ -20,9 +20,10 @@ describe "agent_types/index" do
20
20
  end
21
21
 
22
22
  it "renders a list of agent_types" do
23
+ allow(view).to receive(:policy).and_return double(create?: true, update?: true, destroy?: true)
23
24
  render
24
25
  # Run the generator again with the --webrat flag if you want to use webrat matchers
25
- assert_select "tr>td", :text => "Name".to_s, :count => 2
26
+ assert_select "tr>td", text: "Name".to_s, count: 2
26
27
  # Run the generator again with the --webrat flag if you want to use webrat matchers
27
28
  assert_select "tr>td:nth-child(3)", /テキスト/
28
29
  # Run the generator again with the --webrat flag if you want to use webrat matchers
@@ -11,6 +11,7 @@ describe "agent_types/show" do
11
11
  end
12
12
 
13
13
  it "renders attributes in <p>" do
14
+ allow(view).to receive(:policy).and_return double(update?: true)
14
15
  render
15
16
  # Run the generator again with the --webrat flag if you want to use webrat matchers
16
17
  rendered.should match(/Name/)
@@ -20,9 +20,10 @@ describe "create_types/index" do
20
20
  end
21
21
 
22
22
  it "renders a list of create_types" do
23
+ allow(view).to receive(:policy).and_return double(create?: true, update?: true, destroy?: true)
23
24
  render
24
25
  # Run the generator again with the --webrat flag if you want to use webrat matchers
25
- assert_select "tr>td", :text => "Name".to_s, :count => 2
26
+ assert_select "tr>td", text: "Name".to_s, count: 2
26
27
  # Run the generator again with the --webrat flag if you want to use webrat matchers
27
28
  assert_select "tr>td:nth-child(3)", /テキスト/
28
29
  # Run the generator again with the --webrat flag if you want to use webrat matchers
@@ -9,9 +9,6 @@ describe "creates/edit" do
9
9
  :agent_id => 1
10
10
  ))
11
11
  @create_types = CreateType.all
12
- @ability = Object.new
13
- @ability.extend(CanCan::Ability)
14
- controller.stub(:current_ability) { @ability }
15
12
  end
16
13
 
17
14
  it "renders the edit create form" do
@@ -12,14 +12,12 @@ describe "creates/index" do
12
12
  :agent_id => 2
13
13
  )
14
14
  ]).page(1))
15
- @ability = Object.new
16
- @ability.extend(CanCan::Ability)
17
- controller.stub(:current_ability) { @ability }
18
15
  end
19
16
 
20
17
  it "renders a list of creates" do
18
+ allow(view).to receive(:policy).and_return double(create?: true, destroy?: true)
21
19
  render
22
20
  # Run the generator again with the --webrat flag if you want to use webrat matchers
23
- assert_select "tr>td", :text => Manifestation.find(1).original_title, :count => 2
21
+ assert_select "tr>td", text: Manifestation.find(1).original_title, count: 2
24
22
  end
25
23
  end
@@ -9,9 +9,6 @@ describe "creates/new" do
9
9
  :agent_id => 1
10
10
  ).as_new_record)
11
11
  @create_types = CreateType.all
12
- @ability = Object.new
13
- @ability.extend(CanCan::Ability)
14
- controller.stub(:current_ability) { @ability }
15
12
  end
16
13
 
17
14
  it "renders new create form" do
@@ -6,9 +6,6 @@ describe "creates/show" do
6
6
  :work_id => 1,
7
7
  :agent_id => 1
8
8
  ))
9
- @ability = Object.new
10
- @ability.extend(CanCan::Ability)
11
- controller.stub(:current_ability) { @ability }
12
9
  end
13
10
 
14
11
  it "renders attributes in <p>" do
@@ -22,12 +22,13 @@ describe "import_requests/index" do
22
22
  end
23
23
 
24
24
  it "renders a list of import_requests" do
25
+ allow(view).to receive(:policy).and_return double(destroy?: true)
25
26
  render
26
27
  # Run the generator again with the --webrat flag if you want to use webrat matchers
27
- assert_select "tr>td:nth-child(1)", :text => "1"
28
+ assert_select "tr>td:nth-child(1)", text: "1"
28
29
  # Run the generator again with the --webrat flag if you want to use webrat matchers
29
30
  assert_select "tr>td:nth-child(2)", /admin\n 1111111111\n/
30
31
  # Run the generator again with the --webrat flag if you want to use webrat matchers
31
- assert_select "tr>td:nth-child(3)", :text => localized_state('pending')
32
+ assert_select "tr>td:nth-child(3)", text: localized_state('pending')
32
33
  end
33
34
  end
@@ -0,0 +1,25 @@
1
+ require "rails_helper.rb"
2
+
3
+ describe "manifestations/index" do
4
+ before(:each) do
5
+ @manifestations = assign(:manifestations,
6
+ Kaminari.paginate_array( [
7
+ FactoryGirl.create(:manifestation),
8
+ ], total_count: 1).page(1)
9
+ )
10
+ @index_agent = {}
11
+ @count = { query_result: 1 }
12
+ @reservable_facet = @carrier_type_facet = @language_facet = @library_facet = @pub_year_facet = []
13
+ @seconds = 0
14
+ @max_number_of_results = 500
15
+ view.stub(:params).and_return(ActionController::Parameters.new(per_page: 50))
16
+ end
17
+
18
+ describe "sort_by menu" do
19
+ it "should reflect per_page params for views" do
20
+ render
21
+ expect(rendered).to have_selector "select#per_page option[value='50'][selected='selected']"
22
+ end
23
+ end
24
+ end
25
+
@@ -0,0 +1,23 @@
1
+ require "rails_helper.rb"
2
+
3
+ describe "manifestations/index.rdf.builder" do
4
+ before(:each) do
5
+ manifestation = FactoryGirl.create(:manifestation)
6
+ @manifestations = assign(:manifestations, [ manifestation ] )
7
+ @library_group = LibraryGroup.first
8
+ view.stub(:params).and_return(ActionController::Parameters.new)
9
+ end
10
+
11
+ it "should export RDF format" do
12
+ params[:format] = "rdf"
13
+ render
14
+ doc = Nokogiri::XML(rendered)
15
+ nodes = doc.css('item')
16
+ expect(nodes).not_to be_empty
17
+ nodes.each do |node|
18
+ rdf_ns = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
19
+ expect(node.attribute_with_ns("about", rdf_ns).value).not_to be_empty
20
+ end
21
+ end
22
+ end
23
+
@@ -0,0 +1,17 @@
1
+ require "rails_helper.rb"
2
+
3
+ describe "manifestations/index.txt.erb" do
4
+ before(:each) do
5
+ manifestation = FactoryGirl.create(:manifestation)
6
+ manifestation.items << FactoryGirl.create(:item, bookstore_id: 1, budget_type_id: 1, price: 100)
7
+ @manifestations = assign(:manifestations, [ manifestation ] )
8
+ end
9
+
10
+ it "should excludes librarian specific fields" do
11
+ params[:format] = "text"
12
+ render
13
+ csv = CSV.parse(rendered, headers: true, col_sep: "\t")
14
+ expect(csv["bookstore"].compact).to be_empty
15
+ end
16
+ end
17
+
@@ -5,12 +5,10 @@ describe "manifestations/show" do
5
5
 
6
6
  before(:each) do
7
7
  assign(:manifestation, FactoryGirl.create(:manifestation))
8
- @ability = Object.new
9
- @ability.extend(CanCan::Ability)
10
- controller.stub(:current_ability) { @ability }
11
8
  end
12
9
 
13
10
  it "renders attributes in <p>" do
11
+ allow(view).to receive(:policy).and_return double(create?: true)
14
12
  render
15
13
  # Run the generator again with the --webrat flag if you want to use webrat matchers
16
14
  rendered.should match(/1/)
@@ -18,6 +16,7 @@ describe "manifestations/show" do
18
16
 
19
17
  describe "identifier_link" do
20
18
  it "renders a link to CiNii Books" do
19
+ allow(view).to receive(:policy).and_return double(create?: true)
21
20
  assign(:manifestation, manifestations(:manifestation_00217))
22
21
  render
23
22
  rendered.should include '<a href="http://ci.nii.ac.jp/ncid/BN15603730">BN15603730</a>'
@@ -0,0 +1,16 @@
1
+ require 'rails_helper'
2
+
3
+ describe "manifestations/show.txt.erb" do
4
+ fixtures :all
5
+
6
+ before(:each) do
7
+ assign(:manifestation, FactoryGirl.create(:manifestation))
8
+ end
9
+
10
+ it "renders info" do
11
+ allow(view).to receive(:policy).and_return double(create?: true)
12
+ render
13
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
14
+ rendered.should match(/1/)
15
+ end
16
+ end
@@ -6,9 +6,6 @@ describe "owns/edit" do
6
6
  :item_id => 1,
7
7
  :agent_id => 1
8
8
  ))
9
- @ability = Object.new
10
- @ability.extend(CanCan::Ability)
11
- controller.stub(:current_ability) { @ability }
12
9
  end
13
10
 
14
11
  it "renders the edit own form" do
@@ -12,14 +12,12 @@ describe "owns/index" do
12
12
  :agent_id => 2
13
13
  )
14
14
  ]).page(1))
15
- @ability = Object.new
16
- @ability.extend(CanCan::Ability)
17
- controller.stub(:current_ability) { @ability }
18
15
  end
19
16
 
20
17
  it "renders a list of owns" do
18
+ allow(view).to receive(:policy).and_return double(create?: true, destroy?: true)
21
19
  render
22
20
  # Run the generator again with the --webrat flag if you want to use webrat matchers
23
- assert_select "tr>td", :text => Item.find(1).item_identifier, :count => 2
21
+ assert_select "tr>td", text: Item.find(1).item_identifier, count: 2
24
22
  end
25
23
  end
@@ -6,9 +6,6 @@ describe "owns/new" do
6
6
  :item_id => 1,
7
7
  :agent_id => 1
8
8
  ).as_new_record)
9
- @ability = Object.new
10
- @ability.extend(CanCan::Ability)
11
- controller.stub(:current_ability) { @ability }
12
9
  end
13
10
 
14
11
  it "renders new own form" do