enju_biblio 0.2.0.beta.3 → 0.2.0.beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/agents_controller.rb +6 -0
  3. data/app/controllers/carrier_types_controller.rb +24 -0
  4. data/app/controllers/import_requests_controller.rb +3 -3
  5. data/app/controllers/items_controller.rb +11 -5
  6. data/app/controllers/manifestations_controller.rb +10 -15
  7. data/app/controllers/picture_files_controller.rb +1 -0
  8. data/app/helpers/manifestations_helper.rb +8 -8
  9. data/app/models/agent.rb +7 -3
  10. data/app/models/agent_import_file.rb +2 -1
  11. data/app/models/carrier_type.rb +17 -0
  12. data/app/models/import_request.rb +23 -21
  13. data/app/models/manifestation.rb +17 -3
  14. data/app/models/picture_file.rb +2 -1
  15. data/app/models/resource_export_file.rb +2 -1
  16. data/app/models/resource_import_file.rb +2 -1
  17. data/app/views/agent_import_results/index.html.erb +2 -2
  18. data/app/views/agents/_form.html.erb +1 -1
  19. data/app/views/agents/index.rss.builder +2 -2
  20. data/app/views/carrier_types/_form.html.erb +4 -0
  21. data/app/views/carrier_types/show.html.erb +5 -0
  22. data/app/views/creates/_index_agent.html.erb +2 -2
  23. data/app/views/creates/_index_work.html.erb +2 -2
  24. data/app/views/items/_shelf_picture.html+phone.erb +1 -1
  25. data/app/views/items/_shelf_picture.html.erb +1 -1
  26. data/app/views/items/index.html.erb +1 -1
  27. data/app/views/layouts/agents.html.erb +2 -2
  28. data/app/views/layouts/items.html.erb +1 -1
  29. data/app/views/layouts/manifestations.html.erb +3 -3
  30. data/app/views/manifestations/_carrier_type_facet.html.erb +1 -1
  31. data/app/views/manifestations/_classification_facet.html.erb +2 -2
  32. data/app/views/manifestations/_export_list.html.erb +3 -3
  33. data/app/views/manifestations/_form.html.erb +5 -11
  34. data/app/views/manifestations/_index_form_parent.html.erb +1 -1
  35. data/app/views/manifestations/_language_facet.html.erb +1 -1
  36. data/app/views/manifestations/_library_facet.html.erb +1 -1
  37. data/app/views/manifestations/_manifestation.html.erb +1 -1
  38. data/app/views/manifestations/_manifestation_list.html.erb +2 -2
  39. data/app/views/manifestations/_paginate_id_link.html.erb +1 -1
  40. data/app/views/manifestations/_paginate_id_store.html.erb +9 -9
  41. data/app/views/manifestations/_physical_description.html.erb +16 -0
  42. data/app/views/manifestations/_pub_year_facet.html.erb +1 -1
  43. data/app/views/manifestations/_reservable_facet.html.erb +2 -2
  44. data/app/views/manifestations/_session_ids.html.erb +3 -1
  45. data/app/views/manifestations/_show_detail_librarian.html.erb +1 -8
  46. data/app/views/manifestations/_show_detail_user.html.erb +1 -8
  47. data/app/views/manifestations/_show_index.html+phone.erb +2 -2
  48. data/app/views/manifestations/_show_index.html.erb +2 -2
  49. data/app/views/manifestations/_show_parent_form.html.erb +1 -1
  50. data/app/views/manifestations/_show_series_index.html.erb +2 -2
  51. data/app/views/manifestations/_title.html+phone.erb +1 -1
  52. data/app/views/manifestations/_title.html.erb +2 -2
  53. data/app/views/manifestations/index.html.erb +6 -6
  54. data/app/views/manifestations/index.rdf.builder +2 -2
  55. data/app/views/manifestations/index.rss.builder +2 -2
  56. data/app/views/produces/_index_manifestation.html.erb +2 -2
  57. data/app/views/realizes/_index_expression.html.erb +2 -2
  58. data/app/views/resource_import_results/index.html.erb +2 -2
  59. data/config/locales/translation_en.yml +4 -0
  60. data/config/locales/translation_ja.yml +5 -0
  61. data/db/migrate/20160801080612_add_most_recent_to_import_request_transitions.rb +9 -0
  62. data/db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb +9 -0
  63. data/db/migrate/20160801080637_add_most_recent_to_resource_export_file_transitions.rb +9 -0
  64. data/db/migrate/20160801080643_add_most_recent_to_agent_import_file_transitions.rb +9 -0
  65. data/db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb +11 -0
  66. data/lib/enju_biblio/biblio_helper.rb +15 -15
  67. data/lib/enju_biblio/version.rb +1 -1
  68. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/should_import_without_errors.yml +275 -0
  69. data/spec/controllers/agent_types_controller_spec.rb +1 -1
  70. data/spec/controllers/carrier_types_controller_spec.rb +1 -1
  71. data/spec/controllers/content_types_controller_spec.rb +1 -1
  72. data/spec/controllers/create_types_controller_spec.rb +1 -1
  73. data/spec/controllers/creates_controller_spec.rb +1 -1
  74. data/spec/controllers/form_of_works_controller_spec.rb +2 -1
  75. data/spec/controllers/frequencies_controller_spec.rb +1 -1
  76. data/spec/controllers/identifier_types_controller_spec.rb +1 -1
  77. data/spec/controllers/import_requests_controller_spec.rb +3 -1
  78. data/spec/controllers/items_controller_spec.rb +12 -1
  79. data/spec/controllers/licenses_controller_spec.rb +1 -1
  80. data/spec/controllers/manifestations_controller_spec.rb +11 -0
  81. data/spec/controllers/medium_of_performances_controller_spec.rb +1 -1
  82. data/spec/controllers/produce_types_controller_spec.rb +1 -1
  83. data/spec/controllers/produces_controller_spec.rb +1 -1
  84. data/spec/controllers/realize_types_controller_spec.rb +1 -1
  85. data/spec/controllers/realizes_controller_spec.rb +1 -1
  86. data/spec/dummy/app/models/user.rb +9 -0
  87. data/spec/dummy/db/migrate/20160703184619_add_most_recent_to_reserve_transitions.rb +9 -0
  88. data/spec/dummy/db/migrate/20160703184650_add_most_recent_to_manifestation_checkout_stat_transitions.rb +9 -0
  89. data/spec/dummy/db/migrate/20160703184723_add_most_recent_to_manifestation_reserve_stat_transitions.rb +9 -0
  90. data/spec/dummy/db/migrate/20160703184747_add_most_recent_to_user_checkout_stat_transitions.rb +9 -0
  91. data/spec/dummy/db/migrate/20160703184805_add_most_recent_to_user_reserve_stat_transitions.rb +9 -0
  92. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  93. data/spec/dummy/db/migrate/20160703190209_add_foreign_key_on_manifestation_id_to_reserve.rb +5 -0
  94. data/spec/dummy/db/migrate/20160813191533_add_book_jacket_source_to_library_group.rb +5 -0
  95. data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
  96. data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
  97. data/spec/dummy/db/migrate/20160813191820_add_screenshot_generator_to_library_group.rb +5 -0
  98. data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
  99. data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
  100. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
  101. data/spec/dummy/db/schema.rb +30 -9
  102. data/spec/fixtures/library_groups.yml +3 -2
  103. data/spec/fixtures/manifestations.yml +2 -0
  104. data/spec/models/agent_import_file_spec.rb +1 -1
  105. data/spec/models/agent_import_result_spec.rb +1 -1
  106. data/spec/models/agent_merge_list_spec.rb +1 -1
  107. data/spec/models/agent_merge_spec.rb +1 -1
  108. data/spec/models/agent_relationship_spec.rb +1 -1
  109. data/spec/models/agent_relationship_type_spec.rb +1 -1
  110. data/spec/models/agent_spec.rb +29 -1
  111. data/spec/models/agent_type_spec.rb +1 -1
  112. data/spec/models/carrier_type_spec.rb +1 -1
  113. data/spec/models/content_type_spec.rb +1 -1
  114. data/spec/models/country_spec.rb +1 -1
  115. data/spec/models/create_spec.rb +1 -1
  116. data/spec/models/create_type_spec.rb +1 -1
  117. data/spec/models/donate_spec.rb +1 -1
  118. data/spec/models/form_of_work_spec.rb +1 -1
  119. data/spec/models/frequency_spec.rb +1 -1
  120. data/spec/models/identifier_spec.rb +1 -1
  121. data/spec/models/identifier_type_spec.rb +1 -1
  122. data/spec/models/import_request_spec.rb +1 -1
  123. data/spec/models/item_spec.rb +1 -1
  124. data/spec/models/language_spec.rb +1 -1
  125. data/spec/models/license_spec.rb +1 -1
  126. data/spec/models/manifestation_relationship_spec.rb +1 -1
  127. data/spec/models/manifestation_relationship_type_spec.rb +1 -1
  128. data/spec/models/manifestation_spec.rb +2 -0
  129. data/spec/models/manifestation_spec.rb.mod +337 -0
  130. data/spec/models/medium_of_performance_spec.rb +1 -1
  131. data/spec/models/own_spec.rb +1 -1
  132. data/spec/models/picture_file_spec.rb +1 -1
  133. data/spec/models/produce_spec.rb +1 -1
  134. data/spec/models/produce_type_spec.rb +1 -1
  135. data/spec/models/realize_spec.rb +1 -1
  136. data/spec/models/realize_type_spec.rb +1 -1
  137. data/spec/models/resource_import_result_spec.rb +1 -1
  138. data/spec/models/series_statement_merge_list_spec.rb +1 -1
  139. data/spec/models/series_statement_merge_spec.rb +1 -1
  140. data/spec/models/series_statement_spec.rb +1 -1
  141. data/spec/requests/agents_spec.rb +1 -1
  142. data/spec/requests/create_types_spec.rb +1 -1
  143. data/spec/requests/items_spec.rb +1 -1
  144. data/spec/requests/manifestations_spec.rb +1 -1
  145. data/spec/requests/produce_types_spec.rb +1 -1
  146. data/spec/requests/realize_types_spec.rb +1 -1
  147. data/spec/requests/series_statement_merge_lists_spec.rb +1 -1
  148. data/spec/requests/series_statement_merges_spec.rb +1 -1
  149. data/spec/routing/agent_relationship_types_routing_spec.rb +1 -1
  150. data/spec/routing/agent_relationships_routing_spec.rb +1 -1
  151. data/spec/routing/agents_routing_spec.rb +1 -1
  152. data/spec/routing/content_types_routing_spec.rb +1 -1
  153. data/spec/routing/create_types_routing_spec.rb +1 -1
  154. data/spec/routing/creates_routing_spec.rb +1 -1
  155. data/spec/routing/items_routing_spec.rb +1 -1
  156. data/spec/routing/licenses_routing_spec.rb +1 -1
  157. data/spec/routing/manifestation_relationship_types_routing_spec.rb +1 -1
  158. data/spec/routing/manifestation_relationships_routing_spec.rb +1 -1
  159. data/spec/routing/manifestations_routing_spec.rb +1 -1
  160. data/spec/routing/produce_types_routing_spec.rb +1 -1
  161. data/spec/routing/realize_types_routing_spec.rb +1 -1
  162. data/spec/routing/realizes_routing_spec.rb +1 -1
  163. data/spec/routing/resource_export_files_routing_spec.rb +1 -1
  164. data/spec/routing/resource_import_files_routing_spec.rb +1 -1
  165. data/spec/routing/series_statement_merge_lists_routing_spec.rb +1 -1
  166. data/spec/routing/series_statement_merges_routing_spec.rb +1 -1
  167. data/spec/views/agent_types/edit.html.erb_spec.rb +1 -1
  168. data/spec/views/agent_types/index.html.erb_spec.rb +1 -1
  169. data/spec/views/agent_types/new.html.erb_spec.rb +1 -1
  170. data/spec/views/agent_types/show.html.erb_spec.rb +1 -1
  171. data/spec/views/create_types/edit.html.erb_spec.rb +1 -1
  172. data/spec/views/create_types/index.html.erb_spec.rb +1 -1
  173. data/spec/views/create_types/new.html.erb_spec.rb +1 -1
  174. data/spec/views/create_types/show.html.erb_spec.rb +1 -1
  175. data/spec/views/creates/edit.html.erb_spec.rb +1 -1
  176. data/spec/views/creates/index.html.erb_spec.rb +1 -1
  177. data/spec/views/creates/new.html.erb_spec.rb +1 -1
  178. data/spec/views/creates/show.html.erb_spec.rb +1 -1
  179. data/spec/views/import_requests/edit.html.erb_spec.rb +1 -1
  180. data/spec/views/import_requests/index.html.erb_spec.rb +1 -1
  181. data/spec/views/import_requests/new.html.erb_spec.rb +1 -1
  182. data/spec/views/import_requests/show.html.erb_spec.rb +1 -1
  183. data/spec/views/items/index.html.erb_spec.rb +33 -0
  184. data/spec/views/manifestations/index.html.erb_spec.rb +1 -1
  185. data/spec/views/manifestations/index.rdf.builder_spec.rb +1 -1
  186. data/spec/views/manifestations/show.html.erb_spec.rb +27 -3
  187. data/spec/views/owns/edit.html.erb_spec.rb +1 -1
  188. data/spec/views/owns/index.html.erb_spec.rb +1 -1
  189. data/spec/views/owns/new.html.erb_spec.rb +1 -1
  190. data/spec/views/owns/show.html.erb_spec.rb +1 -1
  191. data/spec/views/produce_types/edit.html.erb_spec.rb +1 -1
  192. data/spec/views/produce_types/index.html.erb_spec.rb +1 -1
  193. data/spec/views/produce_types/new.html.erb_spec.rb +1 -1
  194. data/spec/views/produce_types/show.html.erb_spec.rb +1 -1
  195. data/spec/views/produces/edit.html.erb_spec.rb +1 -1
  196. data/spec/views/produces/index.html.erb_spec.rb +1 -1
  197. data/spec/views/produces/new.html.erb_spec.rb +1 -1
  198. data/spec/views/produces/show.html.erb_spec.rb +1 -1
  199. data/spec/views/realize_types/edit.html.erb_spec.rb +1 -1
  200. data/spec/views/realize_types/index.html.erb_spec.rb +1 -1
  201. data/spec/views/realize_types/new.html.erb_spec.rb +1 -1
  202. data/spec/views/realize_types/show.html.erb_spec.rb +1 -1
  203. data/spec/views/realizes/edit.html.erb_spec.rb +1 -1
  204. data/spec/views/realizes/index.html.erb_spec.rb +1 -1
  205. data/spec/views/realizes/new.html.erb_spec.rb +1 -1
  206. data/spec/views/realizes/show.html.erb_spec.rb +1 -1
  207. data/spec/views/resource_export_files/edit.html.erb_spec.rb +1 -1
  208. data/spec/views/resource_export_files/index.html.erb_spec.rb +1 -1
  209. data/spec/views/resource_export_files/new.html.erb_spec.rb +1 -1
  210. data/spec/views/resource_export_files/show.html.erb_spec.rb +1 -1
  211. data/spec/views/resource_import_files/index.html.erb_spec.rb +1 -1
  212. data/spec/views/resource_import_files/show.html.erb_spec.rb +1 -1
  213. data/spec/views/resource_import_results/index.html.erb_spec.rb +1 -1
  214. data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
  215. data/spec/views/series_statement_merge_lists/edit.html.erb_spec.rb +1 -1
  216. data/spec/views/series_statement_merge_lists/index.html.erb_spec.rb +1 -1
  217. data/spec/views/series_statement_merge_lists/new.html.erb_spec.rb +1 -1
  218. data/spec/views/series_statement_merge_lists/show.html.erb_spec.rb +1 -1
  219. data/spec/views/series_statement_merges/edit.html.erb_spec.rb +1 -1
  220. data/spec/views/series_statement_merges/index.html.erb_spec.rb +1 -1
  221. data/spec/views/series_statement_merges/new.html.erb_spec.rb +1 -1
  222. data/spec/views/series_statement_merges/show.html.erb_spec.rb +1 -1
  223. metadata +491 -447
  224. data/spec/dummy/config/initializers/enju_leaf.rb +0 -8
  225. data/spec/dummy/db/migrate/20160813130535_add_email_to_library_group.rb +0 -5
  226. data/spec/dummy/db/test.sqlite3 +0 -0
  227. data/spec/dummy/tmp/cache/stdout +0 -25
  228. data/spec/dummy/tmp/pids/redis-test.pid +0 -1
@@ -0,0 +1,337 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'rails_helper'
3
+
4
+ describe Manifestation, :solr => true do
5
+ fixtures :all
6
+ before do
7
+ Manifestation.reindex
8
+ end
9
+
10
+ it "should set year_of_publication" do
11
+ manifestation = FactoryGirl.create(:manifestation, :pub_date => '2000')
12
+ manifestation.year_of_publication.should eq 2000
13
+ manifestation.date_of_publication.should eq Time.zone.parse('2000-01-01')
14
+ end
15
+
16
+ it "should set date_of_publication" do
17
+ manifestation = FactoryGirl.create(:manifestation, :pub_date => '2000-01')
18
+ manifestation.year_of_publication.should eq 2000
19
+ manifestation.month_of_publication.should eq 1
20
+ manifestation.date_of_publication.should eq Time.zone.parse('2000-01-01')
21
+ end
22
+
23
+ it "should set volume_number" do
24
+ manifestation = FactoryGirl.create(:manifestation, :volume_number_string => '第1巻', :issue_number_string => '20号分冊1', :edition_string => '第3版')
25
+ manifestation.volume_number.should eq 1
26
+ manifestation.issue_number.should eq 20
27
+ manifestation.edition.should eq 3
28
+ end
29
+
30
+ it "should search title in openurl" do
31
+ openurl = Openurl.new({:title => "プログラミング"})
32
+ results = openurl.search
33
+ openurl.query_text.should eq "btitle_text:プログラミング"
34
+ results.size.should eq 7
35
+ openurl = Openurl.new({:jtitle => "テスト"})
36
+ results = openurl.search
37
+ results.size.should eq 3
38
+ openurl.query_text.should eq "jtitle_text:テスト"
39
+ openurl = Openurl.new({:atitle => "2005"})
40
+ results = openurl.search
41
+ results.size.should eq 1
42
+ openurl.query_text.should eq "atitle_text:2005"
43
+ openurl = Openurl.new({:atitle => "テスト", :jtitle => "テスト雑誌"})
44
+ results = openurl.search
45
+ results.size.should eq 2
46
+ end
47
+
48
+ it "should search agent in openurl" do
49
+ openurl = Openurl.new({:aulast => "Administrator"})
50
+ results = openurl.search
51
+ openurl.query_text.should eq "au_text:Administrator"
52
+ results.size.should eq 2
53
+ openurl = Openurl.new({:aufirst => "名称"})
54
+ results = openurl.search
55
+ openurl.query_text.should eq "au_text:名称"
56
+ results.size.should eq 1
57
+ openurl = Openurl.new({:au => "テスト"})
58
+ results = openurl.search
59
+ openurl.query_text.should eq "au_text:テスト"
60
+ results.size.should eq 1
61
+ openurl = Openurl.new({:pub => "Administrator"})
62
+ results = openurl.search
63
+ openurl.query_text.should eq "publisher_text:Administrator"
64
+ results.size.should eq 4
65
+ end
66
+
67
+ it "should search isbn in openurl" do
68
+ openurl = Openurl.new({:api => "openurl", :isbn => "4798"})
69
+ results = openurl.search
70
+ openurl.query_text.should eq "isbn_sm:4798*"
71
+ results.size.should eq 2
72
+ end
73
+
74
+ it "should search issn in openurl" do
75
+ openurl = Openurl.new({:api => "openurl", :issn => "0913"})
76
+ results = openurl.search
77
+ openurl.query_text.should eq "issn_sm:0913*"
78
+ results.size.should eq 1
79
+ end
80
+
81
+ it "should search any in openurl" do
82
+ openurl = Openurl.new({:any => "テスト"})
83
+ results = openurl.search
84
+ results.size.should eq 9
85
+ end
86
+
87
+ it "should search multi in openurl" do
88
+ openurl = Openurl.new({:btitle => "CGI Perl プログラミング"})
89
+ results = openurl.search
90
+ results.size.should eq 2
91
+ openurl = Openurl.new({:jtitle => "テスト", :pub => "テスト"})
92
+ results = openurl.search
93
+ results.size.should eq 2
94
+ end
95
+
96
+ it "shoulld get search_error in openurl" do
97
+ lambda{Openurl.new({:isbn => "12345678901234"})}.should raise_error(OpenurlQuerySyntaxError)
98
+ lambda{Openurl.new({:issn => "1234abcd"})}.should raise_error(OpenurlQuerySyntaxError)
99
+ lambda{Openurl.new({:aufirst => "テスト 名称"})}.should raise_error(OpenurlQuerySyntaxError)
100
+ end
101
+
102
+ it "should search in sru" do
103
+ sru = Sru.new({:query => "title=Ruby"})
104
+ sru.search
105
+ sru.manifestations.size.should eq 18
106
+ sru.manifestations.first.titles.first.should eq 'Ruby'
107
+ sru = Sru.new({:query => "title=^ruby"})
108
+ sru.search
109
+ sru.manifestations.size.should eq 9
110
+ sru = Sru.new({:query => 'title ALL "awk sed"'})
111
+ sru.search
112
+ sru.manifestations.size.should eq 2
113
+ sru.manifestations.collect{|m| m.id}.should eq [184, 116]
114
+ sru = Sru.new({:query => 'title ANY "ruby awk sed"'})
115
+ sru.search
116
+ sru.manifestations.size.should eq 22
117
+ sru = Sru.new({:query => 'isbn=9784756137470'})
118
+ sru.search
119
+ sru.manifestations.first.id.should eq 114
120
+ sru = Sru.new({:query => "creator=テスト"})
121
+ sru.search
122
+ sru.manifestations.size.should eq 1
123
+ end
124
+
125
+ it "should search date in sru" do
126
+ sru = Sru.new({:query => "from = 2000-09 AND until = 2000-11-01"})
127
+ sru.search
128
+ sru.manifestations.size.should eq 1
129
+ sru.manifestations.first.id.should eq 120
130
+ sru = Sru.new({:query => "from = 1993-02-24"})
131
+ sru.search
132
+ sru.manifestations.size.should eq 5
133
+ sru = Sru.new({:query => "until = 2006-08-06"})
134
+ sru.search
135
+ sru.manifestations.size.should eq 4
136
+ end
137
+
138
+ it "should accept sort_by in sru" do
139
+ sru = Sru.new({:query => "title=Ruby"})
140
+ sru.sort_by.should eq({:sort_by => 'created_at', :order => 'desc'})
141
+ sru = Sru.new({:query => 'title=Ruby AND sortBy="title/sort.ascending"', :sortKeys => 'creator,0', :version => '1.2'})
142
+ sru.sort_by.should eq({:sort_by => 'sort_title', :order => 'asc'})
143
+ sru = Sru.new({:query => 'title=Ruby AND sortBy="title/sort.ascending"', :sortKeys => 'creator,0', :version => '1.1'})
144
+ sru.sort_by.should eq({:sort_by => 'creator', :order => 'desc'})
145
+ sru = Sru.new({:query => 'title=Ruby AND sortBy="title/sort.ascending"', :sortKeys => 'creator,1', :version => '1.1'})
146
+ sru.sort_by.should eq({:sort_by => 'creator', :order => 'asc'})
147
+ sru = Sru.new({:query => 'title=Ruby AND sortBy="title'})
148
+ sru.sort_by.should eq({:sort_by => 'sort_title', :order => 'asc'})
149
+ #TODO ソート基準が入手しやすさの場合の処理
150
+ end
151
+
152
+ it "should accept ranges in sru" do
153
+ sru = Sru.new({:query => "from = 1993-02-24 AND until = 2006-08-06 AND title=プログラミング"})
154
+ sru.search
155
+ sru.manifestations.size.should eq 2
156
+ sru = Sru.new({:query => "until = 2000 AND title=プログラミング"})
157
+ sru.search
158
+ sru.manifestations.size.should eq 1
159
+ sru = Sru.new({:query => "from = 2006 AND title=プログラミング"})
160
+ sru.search
161
+ sru.manifestations.size.should eq 1
162
+ sru = Sru.new({:query => "from = 2007 OR title=awk"})
163
+ sru.search
164
+ sru.manifestations.size.should eq 6
165
+ end
166
+
167
+ it "should be reserved" do
168
+ manifestations(:manifestation_00007).is_reserved_by?(users(:admin)).should be_truthy
169
+ end
170
+
171
+ it "should not be reserved" do
172
+ manifestations(:manifestation_00007).is_reserved_by?(users(:user1)).should be_falsy
173
+ end
174
+
175
+ it "should_get_number_of_pages" do
176
+ manifestations(:manifestation_00001).number_of_pages.should eq 100
177
+ end
178
+
179
+ it "should get youtube_id" do
180
+ manifestations(:manifestation_00022).youtube_id.should eq 'BSHBzd9ftDE'
181
+ end
182
+
183
+ it "should get nicovideo_id" do
184
+ manifestations(:manifestation_00023).nicovideo_id.should eq 'sm3015373'
185
+ end
186
+
187
+ it "should have parent_of_series" do
188
+ manifestations(:manifestation_00001).parent_of_series.should be_truthy
189
+ end
190
+
191
+ it "should respond to extract_text" do
192
+ manifestations(:manifestation_00001).extract_text.should be_nil
193
+ end
194
+
195
+ it "should not be reserved it it has no item" do
196
+ manifestations(:manifestation_00008).is_reservable_by?(users(:admin)).should be_falsy
197
+ end
198
+
199
+ it "should respond to title" do
200
+ manifestations(:manifestation_00001).title.should be_truthy
201
+ end
202
+
203
+ it "should respond to pickup" do
204
+ lambda{Manifestation.pickup}.should_not raise_error #(ActiveRecord::RecordNotFound)
205
+ end
206
+
207
+ it "should be periodical if its series_statement is periodical" do
208
+ manifestations(:manifestation_00202).serial?.should be_truthy
209
+ end
210
+
211
+ it "should validate access_address" do
212
+ manifestation = manifestations(:manifestation_00202)
213
+ manifestation.access_address = 'http:/www.example.jp'
214
+ manifestation.should_not be_valid
215
+ end
216
+
217
+ #it "should set series_statement if the manifestation is periodical" do
218
+ # manifestation = series_statements(:two).manifestations.new
219
+ # manifestation.set_series_statements([series_statements(:two)])
220
+ # #manifestation.original_title.should eq 'テスト雑誌2月号'
221
+ # #manifestation.serial_number.should eq 3
222
+ # #manifestation.issue_number.should eq 3
223
+ # #manifestation.volume_number.should eq 1
224
+ #end
225
+
226
+ context ".export" do
227
+ it "should export a header line" do
228
+ lines = Manifestation.export
229
+ csv = CSV.parse(lines, headers: true, col_sep: "\t")
230
+ csv["manifestation_id"].compact.should_not be_empty
231
+ csv["manifestation_identifier"].compact.should_not be_empty
232
+ csv["manifestation_created_at"].compact.should_not be_empty
233
+ csv["manifestation_updated_at"].compact.should_not be_empty
234
+ csv["item_id"].compact.should_not be_empty
235
+ csv["item_created_at"].compact.should_not be_empty
236
+ csv["item_updated_at"].compact.should_not be_empty
237
+ csv["subject:unknown"].compact.should eq manifestations(:manifestation_00001).items.count.times.map{"next-l"}
238
+ csv["classification:ndc9"].compact.should eq manifestations(:manifestation_00001).items.count.times.map{"400"}
239
+ end
240
+
241
+ it "should respect the role of the user" do
242
+ FactoryGirl.create(:item, bookstore_id: 1, price: 100, budget_type_id: 1)
243
+ lines = Manifestation.export
244
+ csv = CSV.parse(lines, headers: true, col_sep: "\t")
245
+ expect(csv["bookstore"].compact).to be_empty
246
+ expect(csv["item_price"].compact).to be_empty
247
+ expect(csv["budget_type"].compact).to be_empty
248
+
249
+ lines = Manifestation.export(format: :txt, role: :Librarian)
250
+ csv = CSV.parse(lines, headers: true, col_sep: "\t")
251
+ expect(csv["bookstore"].compact).not_to be_empty
252
+ expect(csv["item_price"].compact).not_to be_empty
253
+ expect(csv["budget_type"].compact).not_to be_empty
254
+ end
255
+ end
256
+
257
+ if defined?(EnjuCirculation)
258
+ it "should respond to is_checked_out_by?" do
259
+ manifestations(:manifestation_00001).is_checked_out_by?(users(:admin)).should be_truthy
260
+ manifestations(:manifestation_00001).is_checked_out_by?(users(:librarian2)).should be_falsy
261
+ end
262
+ end
263
+
264
+ it "should search with ignoring ideographic variation selectors" do
265
+ FactoryGirl.create(:manifestation, original_title: "葛#{0xE0103.chr(Encoding::UTF_8)}飾区") #葛飾区
266
+ search = Manifestation.search do
267
+ fulltext "葛飾区"
268
+ end
269
+ results = search.execute.results
270
+ expect(results).not_to be_empty
271
+ end
272
+ end
273
+
274
+ # == Schema Information
275
+ #
276
+ # Table name: manifestations
277
+ #
278
+ # id :integer not null, primary key
279
+ # original_title :text not null
280
+ # title_alternative :text
281
+ # title_transcription :text
282
+ # classification_number :string
283
+ # manifestation_identifier :string
284
+ # date_of_publication :datetime
285
+ # date_copyrighted :datetime
286
+ # created_at :datetime
287
+ # updated_at :datetime
288
+ # deleted_at :datetime
289
+ # access_address :string
290
+ # language_id :integer default(1), not null
291
+ # carrier_type_id :integer default(1), not null
292
+ # start_page :integer
293
+ # end_page :integer
294
+ # height :integer
295
+ # width :integer
296
+ # depth :integer
297
+ # price :integer
298
+ # fulltext :text
299
+ # volume_number_string :string
300
+ # issue_number_string :string
301
+ # serial_number_string :string
302
+ # edition :integer
303
+ # note :text
304
+ # repository_content :boolean default(FALSE), not null
305
+ # lock_version :integer default(0), not null
306
+ # required_role_id :integer default(1), not null
307
+ # required_score :integer default(0), not null
308
+ # frequency_id :integer default(1), not null
309
+ # subscription_master :boolean default(FALSE), not null
310
+ # attachment_file_name :string
311
+ # attachment_content_type :string
312
+ # attachment_file_size :integer
313
+ # attachment_updated_at :datetime
314
+ # title_alternative_transcription :text
315
+ # description :text
316
+ # abstract :text
317
+ # available_at :datetime
318
+ # valid_until :datetime
319
+ # date_submitted :datetime
320
+ # date_accepted :datetime
321
+ # date_captured :datetime
322
+ # pub_date :string
323
+ # edition_string :string
324
+ # volume_number :integer
325
+ # issue_number :integer
326
+ # serial_number :integer
327
+ # content_type_id :integer default(1)
328
+ # year_of_publication :integer
329
+ # attachment_meta :text
330
+ # month_of_publication :integer
331
+ # fulltext_content :boolean
332
+ # serial :boolean
333
+ # statement_of_responsibility :text
334
+ # publication_place :text
335
+ # extent :text
336
+ # dimensions :text
337
+ #
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe MediumOfPerformance do
5
5
  #pending "add some examples to (or delete) #{__FILE__}"
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe Own do
5
5
  #pending "add some examples to (or delete) #{__FILE__}"
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe PictureFile do
5
5
  #pending "add some examples to (or delete) #{__FILE__}"
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe Produce do
5
5
  #pending "add some examples to (or delete) #{__FILE__}"
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe ProduceType do
4
4
  it 'should create produce_type' do
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe Realize do
5
5
  #pending "add some examples to (or delete) #{__FILE__}"
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe RealizeType do
4
4
  it 'should create realize_type' do
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe ResourceImportResult do
5
5
  #pending "add some examples to (or delete) #{__FILE__}"
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe SeriesStatementMergeList do
4
4
  fixtures :all
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe SeriesStatementMerge do
4
4
  #pending "add some examples to (or delete) #{__FILE__}"
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe SeriesStatement do
4
4
  fixtures :all
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "Agents" do
4
4
  describe "GET /agents", :solr => true do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "CreateTypes" do
4
4
  describe "GET /create_types" do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "Items" do
4
4
  describe "GET /items", :solr => true do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "Manifestations" do
4
4
  describe "GET /manifestations", :solr => true do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "ProduceTypes" do
4
4
  describe "GET /produce_types" do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "RealizeTypes" do
4
4
  describe "GET /realize_types" do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "SeriesStatementMergeLists" do
4
4
  describe "GET /series_statement_merge_lists" do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "SeriesStatementMerges" do
4
4
  describe "GET /series_statement_merges" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe AgentRelationshipTypesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe AgentRelationshipsController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe AgentsController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe ContentTypesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe CreateTypesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe CreatesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe ItemsController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe LicensesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe ManifestationRelationshipTypesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe ManifestationRelationshipsController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe ManifestationsController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe ProduceTypesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe RealizeTypesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe RealizesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe ResourceExportFilesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe UserImportFilesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe SeriesStatementMergeListsController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'rails_helper'
2
2
 
3
3
  describe SeriesStatementMergesController do
4
4
  describe "routing" do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "agent_types/edit" do
4
4
  before(:each) do
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe "agent_types/index" do
5
5
  before(:each) do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "agent_types/new" do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "agent_types/show" do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "create_types/edit" do
4
4
  before(:each) do
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe "create_types/index" do
5
5
  before(:each) do