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.
- checksums.yaml +4 -4
- data/app/controllers/agents_controller.rb +6 -0
- data/app/controllers/carrier_types_controller.rb +24 -0
- data/app/controllers/import_requests_controller.rb +3 -3
- data/app/controllers/items_controller.rb +11 -5
- data/app/controllers/manifestations_controller.rb +10 -15
- data/app/controllers/picture_files_controller.rb +1 -0
- data/app/helpers/manifestations_helper.rb +8 -8
- data/app/models/agent.rb +7 -3
- data/app/models/agent_import_file.rb +2 -1
- data/app/models/carrier_type.rb +17 -0
- data/app/models/import_request.rb +23 -21
- data/app/models/manifestation.rb +17 -3
- data/app/models/picture_file.rb +2 -1
- data/app/models/resource_export_file.rb +2 -1
- data/app/models/resource_import_file.rb +2 -1
- data/app/views/agent_import_results/index.html.erb +2 -2
- data/app/views/agents/_form.html.erb +1 -1
- data/app/views/agents/index.rss.builder +2 -2
- data/app/views/carrier_types/_form.html.erb +4 -0
- data/app/views/carrier_types/show.html.erb +5 -0
- data/app/views/creates/_index_agent.html.erb +2 -2
- data/app/views/creates/_index_work.html.erb +2 -2
- data/app/views/items/_shelf_picture.html+phone.erb +1 -1
- data/app/views/items/_shelf_picture.html.erb +1 -1
- data/app/views/items/index.html.erb +1 -1
- data/app/views/layouts/agents.html.erb +2 -2
- data/app/views/layouts/items.html.erb +1 -1
- data/app/views/layouts/manifestations.html.erb +3 -3
- data/app/views/manifestations/_carrier_type_facet.html.erb +1 -1
- data/app/views/manifestations/_classification_facet.html.erb +2 -2
- data/app/views/manifestations/_export_list.html.erb +3 -3
- data/app/views/manifestations/_form.html.erb +5 -11
- data/app/views/manifestations/_index_form_parent.html.erb +1 -1
- data/app/views/manifestations/_language_facet.html.erb +1 -1
- data/app/views/manifestations/_library_facet.html.erb +1 -1
- data/app/views/manifestations/_manifestation.html.erb +1 -1
- data/app/views/manifestations/_manifestation_list.html.erb +2 -2
- data/app/views/manifestations/_paginate_id_link.html.erb +1 -1
- data/app/views/manifestations/_paginate_id_store.html.erb +9 -9
- data/app/views/manifestations/_physical_description.html.erb +16 -0
- data/app/views/manifestations/_pub_year_facet.html.erb +1 -1
- data/app/views/manifestations/_reservable_facet.html.erb +2 -2
- data/app/views/manifestations/_session_ids.html.erb +3 -1
- data/app/views/manifestations/_show_detail_librarian.html.erb +1 -8
- data/app/views/manifestations/_show_detail_user.html.erb +1 -8
- data/app/views/manifestations/_show_index.html+phone.erb +2 -2
- data/app/views/manifestations/_show_index.html.erb +2 -2
- data/app/views/manifestations/_show_parent_form.html.erb +1 -1
- data/app/views/manifestations/_show_series_index.html.erb +2 -2
- data/app/views/manifestations/_title.html+phone.erb +1 -1
- data/app/views/manifestations/_title.html.erb +2 -2
- data/app/views/manifestations/index.html.erb +6 -6
- data/app/views/manifestations/index.rdf.builder +2 -2
- data/app/views/manifestations/index.rss.builder +2 -2
- data/app/views/produces/_index_manifestation.html.erb +2 -2
- data/app/views/realizes/_index_expression.html.erb +2 -2
- data/app/views/resource_import_results/index.html.erb +2 -2
- data/config/locales/translation_en.yml +4 -0
- data/config/locales/translation_ja.yml +5 -0
- data/db/migrate/20160801080612_add_most_recent_to_import_request_transitions.rb +9 -0
- data/db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb +9 -0
- data/db/migrate/20160801080637_add_most_recent_to_resource_export_file_transitions.rb +9 -0
- data/db/migrate/20160801080643_add_most_recent_to_agent_import_file_transitions.rb +9 -0
- data/db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb +11 -0
- data/lib/enju_biblio/biblio_helper.rb +15 -15
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/should_import_without_errors.yml +275 -0
- data/spec/controllers/agent_types_controller_spec.rb +1 -1
- data/spec/controllers/carrier_types_controller_spec.rb +1 -1
- data/spec/controllers/content_types_controller_spec.rb +1 -1
- data/spec/controllers/create_types_controller_spec.rb +1 -1
- data/spec/controllers/creates_controller_spec.rb +1 -1
- data/spec/controllers/form_of_works_controller_spec.rb +2 -1
- data/spec/controllers/frequencies_controller_spec.rb +1 -1
- data/spec/controllers/identifier_types_controller_spec.rb +1 -1
- data/spec/controllers/import_requests_controller_spec.rb +3 -1
- data/spec/controllers/items_controller_spec.rb +12 -1
- data/spec/controllers/licenses_controller_spec.rb +1 -1
- data/spec/controllers/manifestations_controller_spec.rb +11 -0
- data/spec/controllers/medium_of_performances_controller_spec.rb +1 -1
- data/spec/controllers/produce_types_controller_spec.rb +1 -1
- data/spec/controllers/produces_controller_spec.rb +1 -1
- data/spec/controllers/realize_types_controller_spec.rb +1 -1
- data/spec/controllers/realizes_controller_spec.rb +1 -1
- data/spec/dummy/app/models/user.rb +9 -0
- data/spec/dummy/db/migrate/20160703184619_add_most_recent_to_reserve_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160703184650_add_most_recent_to_manifestation_checkout_stat_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160703184723_add_most_recent_to_manifestation_reserve_stat_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160703184747_add_most_recent_to_user_checkout_stat_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160703184805_add_most_recent_to_user_reserve_stat_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160703190209_add_foreign_key_on_manifestation_id_to_reserve.rb +5 -0
- data/spec/dummy/db/migrate/20160813191533_add_book_jacket_source_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813191820_add_screenshot_generator_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
- data/spec/dummy/db/schema.rb +30 -9
- data/spec/fixtures/library_groups.yml +3 -2
- data/spec/fixtures/manifestations.yml +2 -0
- data/spec/models/agent_import_file_spec.rb +1 -1
- data/spec/models/agent_import_result_spec.rb +1 -1
- data/spec/models/agent_merge_list_spec.rb +1 -1
- data/spec/models/agent_merge_spec.rb +1 -1
- data/spec/models/agent_relationship_spec.rb +1 -1
- data/spec/models/agent_relationship_type_spec.rb +1 -1
- data/spec/models/agent_spec.rb +29 -1
- data/spec/models/agent_type_spec.rb +1 -1
- data/spec/models/carrier_type_spec.rb +1 -1
- data/spec/models/content_type_spec.rb +1 -1
- data/spec/models/country_spec.rb +1 -1
- data/spec/models/create_spec.rb +1 -1
- data/spec/models/create_type_spec.rb +1 -1
- data/spec/models/donate_spec.rb +1 -1
- data/spec/models/form_of_work_spec.rb +1 -1
- data/spec/models/frequency_spec.rb +1 -1
- data/spec/models/identifier_spec.rb +1 -1
- data/spec/models/identifier_type_spec.rb +1 -1
- data/spec/models/import_request_spec.rb +1 -1
- data/spec/models/item_spec.rb +1 -1
- data/spec/models/language_spec.rb +1 -1
- data/spec/models/license_spec.rb +1 -1
- data/spec/models/manifestation_relationship_spec.rb +1 -1
- data/spec/models/manifestation_relationship_type_spec.rb +1 -1
- data/spec/models/manifestation_spec.rb +2 -0
- data/spec/models/manifestation_spec.rb.mod +337 -0
- data/spec/models/medium_of_performance_spec.rb +1 -1
- data/spec/models/own_spec.rb +1 -1
- data/spec/models/picture_file_spec.rb +1 -1
- data/spec/models/produce_spec.rb +1 -1
- data/spec/models/produce_type_spec.rb +1 -1
- data/spec/models/realize_spec.rb +1 -1
- data/spec/models/realize_type_spec.rb +1 -1
- data/spec/models/resource_import_result_spec.rb +1 -1
- data/spec/models/series_statement_merge_list_spec.rb +1 -1
- data/spec/models/series_statement_merge_spec.rb +1 -1
- data/spec/models/series_statement_spec.rb +1 -1
- data/spec/requests/agents_spec.rb +1 -1
- data/spec/requests/create_types_spec.rb +1 -1
- data/spec/requests/items_spec.rb +1 -1
- data/spec/requests/manifestations_spec.rb +1 -1
- data/spec/requests/produce_types_spec.rb +1 -1
- data/spec/requests/realize_types_spec.rb +1 -1
- data/spec/requests/series_statement_merge_lists_spec.rb +1 -1
- data/spec/requests/series_statement_merges_spec.rb +1 -1
- data/spec/routing/agent_relationship_types_routing_spec.rb +1 -1
- data/spec/routing/agent_relationships_routing_spec.rb +1 -1
- data/spec/routing/agents_routing_spec.rb +1 -1
- data/spec/routing/content_types_routing_spec.rb +1 -1
- data/spec/routing/create_types_routing_spec.rb +1 -1
- data/spec/routing/creates_routing_spec.rb +1 -1
- data/spec/routing/items_routing_spec.rb +1 -1
- data/spec/routing/licenses_routing_spec.rb +1 -1
- data/spec/routing/manifestation_relationship_types_routing_spec.rb +1 -1
- data/spec/routing/manifestation_relationships_routing_spec.rb +1 -1
- data/spec/routing/manifestations_routing_spec.rb +1 -1
- data/spec/routing/produce_types_routing_spec.rb +1 -1
- data/spec/routing/realize_types_routing_spec.rb +1 -1
- data/spec/routing/realizes_routing_spec.rb +1 -1
- data/spec/routing/resource_export_files_routing_spec.rb +1 -1
- data/spec/routing/resource_import_files_routing_spec.rb +1 -1
- data/spec/routing/series_statement_merge_lists_routing_spec.rb +1 -1
- data/spec/routing/series_statement_merges_routing_spec.rb +1 -1
- data/spec/views/agent_types/edit.html.erb_spec.rb +1 -1
- data/spec/views/agent_types/index.html.erb_spec.rb +1 -1
- data/spec/views/agent_types/new.html.erb_spec.rb +1 -1
- data/spec/views/agent_types/show.html.erb_spec.rb +1 -1
- data/spec/views/create_types/edit.html.erb_spec.rb +1 -1
- data/spec/views/create_types/index.html.erb_spec.rb +1 -1
- data/spec/views/create_types/new.html.erb_spec.rb +1 -1
- data/spec/views/create_types/show.html.erb_spec.rb +1 -1
- data/spec/views/creates/edit.html.erb_spec.rb +1 -1
- data/spec/views/creates/index.html.erb_spec.rb +1 -1
- data/spec/views/creates/new.html.erb_spec.rb +1 -1
- data/spec/views/creates/show.html.erb_spec.rb +1 -1
- data/spec/views/import_requests/edit.html.erb_spec.rb +1 -1
- data/spec/views/import_requests/index.html.erb_spec.rb +1 -1
- data/spec/views/import_requests/new.html.erb_spec.rb +1 -1
- data/spec/views/import_requests/show.html.erb_spec.rb +1 -1
- data/spec/views/items/index.html.erb_spec.rb +33 -0
- data/spec/views/manifestations/index.html.erb_spec.rb +1 -1
- data/spec/views/manifestations/index.rdf.builder_spec.rb +1 -1
- data/spec/views/manifestations/show.html.erb_spec.rb +27 -3
- data/spec/views/owns/edit.html.erb_spec.rb +1 -1
- data/spec/views/owns/index.html.erb_spec.rb +1 -1
- data/spec/views/owns/new.html.erb_spec.rb +1 -1
- data/spec/views/owns/show.html.erb_spec.rb +1 -1
- data/spec/views/produce_types/edit.html.erb_spec.rb +1 -1
- data/spec/views/produce_types/index.html.erb_spec.rb +1 -1
- data/spec/views/produce_types/new.html.erb_spec.rb +1 -1
- data/spec/views/produce_types/show.html.erb_spec.rb +1 -1
- data/spec/views/produces/edit.html.erb_spec.rb +1 -1
- data/spec/views/produces/index.html.erb_spec.rb +1 -1
- data/spec/views/produces/new.html.erb_spec.rb +1 -1
- data/spec/views/produces/show.html.erb_spec.rb +1 -1
- data/spec/views/realize_types/edit.html.erb_spec.rb +1 -1
- data/spec/views/realize_types/index.html.erb_spec.rb +1 -1
- data/spec/views/realize_types/new.html.erb_spec.rb +1 -1
- data/spec/views/realize_types/show.html.erb_spec.rb +1 -1
- data/spec/views/realizes/edit.html.erb_spec.rb +1 -1
- data/spec/views/realizes/index.html.erb_spec.rb +1 -1
- data/spec/views/realizes/new.html.erb_spec.rb +1 -1
- data/spec/views/realizes/show.html.erb_spec.rb +1 -1
- data/spec/views/resource_export_files/edit.html.erb_spec.rb +1 -1
- data/spec/views/resource_export_files/index.html.erb_spec.rb +1 -1
- data/spec/views/resource_export_files/new.html.erb_spec.rb +1 -1
- data/spec/views/resource_export_files/show.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_files/index.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_files/show.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_results/index.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
- data/spec/views/series_statement_merge_lists/edit.html.erb_spec.rb +1 -1
- data/spec/views/series_statement_merge_lists/index.html.erb_spec.rb +1 -1
- data/spec/views/series_statement_merge_lists/new.html.erb_spec.rb +1 -1
- data/spec/views/series_statement_merge_lists/show.html.erb_spec.rb +1 -1
- data/spec/views/series_statement_merges/edit.html.erb_spec.rb +1 -1
- data/spec/views/series_statement_merges/index.html.erb_spec.rb +1 -1
- data/spec/views/series_statement_merges/new.html.erb_spec.rb +1 -1
- data/spec/views/series_statement_merges/show.html.erb_spec.rb +1 -1
- metadata +491 -447
- data/spec/dummy/config/initializers/enju_leaf.rb +0 -8
- data/spec/dummy/db/migrate/20160813130535_add_email_to_library_group.rb +0 -5
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/tmp/cache/stdout +0 -25
- 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
|
+
#
|
data/spec/models/own_spec.rb
CHANGED
data/spec/models/produce_spec.rb
CHANGED
data/spec/models/realize_spec.rb
CHANGED
data/spec/requests/items_spec.rb
CHANGED