enju_ndl 0.1.0.pre8 → 0.1.0.pre9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/app/views/ndl_books/index.html.erb +1 -1
- data/lib/enju_ndl/ndl_search.rb +13 -1
- data/lib/enju_ndl/version.rb +1 -1
- data/spec/cassette_library/NdlBook/import/should_get_series_title.yml +115 -0
- data/spec/cassette_library/NdlBook/import/should_get_volume_number.yml +116 -0
- data/spec/cassette_library/NdlBook/import/should_import_audio_cd.yml +162 -0
- data/spec/cassette_library/NdlBook/import/should_import_bibliographic_record.yml +196 -0
- data/spec/cassette_library/NdlBook/import/should_import_bibliographic_record_that_does_not_have_any_classifications.yml +188 -0
- data/spec/cassette_library/NdlBook/import/should_import_pud_date_is_nil.yml +144 -0
- data/spec/cassette_library/NdlBook/import/should_import_series_statement.yml +225 -0
- data/spec/cassette_library/NdlBook/import/should_import_series_statement_if_the_resource_is_periodical.yml +348 -0
- data/spec/cassette_library/NdlBook/import/should_import_title_alternative.yml +233 -0
- data/spec/cassette_library/NdlBook/import/should_import_url_contain_whitespace.yml +217 -0
- data/spec/cassette_library/NdlBook/import/should_import_video_dvd.yml +148 -0
- data/spec/cassette_library/NdlBook/import/should_import_volume_number_string.yml +227 -0
- data/spec/cassette_library/NdlBook/import/should_not_get_series_title_if_book_has_not_series_title.yml +122 -0
- data/spec/cassette_library/NdlBook/import/should_not_get_volume_number_if_book_has_not_volume.yml +111 -0
- data/spec/cassette_library/NdlBook/search/should_not_distinguish_double_byte_space_from_one-byte_space_in_a_query.yml +729 -0
- data/spec/cassette_library/NdlBook/search/should_search_bibliographic_record.yml +411 -0
- data/spec/cassette_library/NdlBooksController/GET_index/should_get_index.yml +491 -0
- data/spec/cassette_library/NdlBooksController/POST_create/should_create_a_bibliographic_record_if_nbn_is_set.yml +255 -0
- data/spec/cassette_library/NdlBooksController/POST_create/should_not_create_a_bibliographic_record_if_nbn_is_not_set.yml +66 -0
- data/spec/cassette_library/Question/should_respond_to_search_crd.yml +542 -0
- data/spec/controllers/ndl_books_controller_spec.rb +4 -6
- data/spec/dummy/config/application.rb +0 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/models/manifestation_spec.rb +5 -4
- data/spec/models/ndl_book_spec.rb +19 -21
- data/spec/models/question_spec.rb +1 -2
- data/spec/spec_helper.rb +7 -1
- metadata +340 -353
- data/spec/cassette_library/enju_ndl/crd.yml +0 -576
- data/spec/cassette_library/enju_ndl/import.yml +0 -2666
- data/spec/cassette_library/enju_ndl/search.yml +0 -3158
- data/spec/support/vcr.rb +0 -4
@@ -9,19 +9,17 @@ describe NdlBook do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
context "search" do
|
12
|
-
|
13
|
-
|
14
|
-
NdlBook.search('library system')[:total_entries].should eq 5188
|
12
|
+
it "should search bibliographic record", :vcr => true do
|
13
|
+
NdlBook.search('library system')[:total_entries].should eq 5193
|
15
14
|
end
|
16
15
|
|
17
|
-
it "should not distinguish double byte space from one-byte space in a query" do
|
16
|
+
it "should not distinguish double byte space from one-byte space in a query", :vcr => true do
|
18
17
|
NdlBook.search("カミュ ペスト")[:total_entries].should eq NdlBook.search("カミュ ペスト")[:total_entries]
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
21
|
context "import" do
|
23
|
-
|
24
|
-
it "should import bibliographic record" do
|
22
|
+
it "should import bibliographic record", :vcr => true do
|
25
23
|
manifestation = NdlBook.import_from_sru_response('21816393')
|
26
24
|
manifestation.isbn.should eq '9784839931995'
|
27
25
|
manifestation.ndc.should eq "007.64"
|
@@ -39,80 +37,80 @@ describe NdlBook do
|
|
39
37
|
manifestation.subjects.first.term.should eq 'プログラミング (コンピュータ)'
|
40
38
|
end
|
41
39
|
|
42
|
-
it "should import bibliographic record that does not have any classifications" do
|
40
|
+
it "should import bibliographic record that does not have any classifications", :vcr => true do
|
43
41
|
manifestation = NdlBook.import_from_sru_response('20286397')
|
44
42
|
manifestation.original_title.should eq "アンパンマンとどうぶつえん"
|
45
43
|
manifestation.title_transcription.should eq "アンパンマン ト ドウブツエン"
|
46
44
|
manifestation.ndc.should be_nil
|
47
45
|
end
|
48
46
|
|
49
|
-
it "should import volume_number_string" do
|
47
|
+
it "should import volume_number_string", :vcr => true do
|
50
48
|
manifestation = NdlBook.import_from_sru_response('21847424')
|
51
49
|
manifestation.volume_number_string.should eq '上'
|
52
50
|
end
|
53
51
|
|
54
|
-
it "should import title_alternative" do
|
52
|
+
it "should import title_alternative", :vcr => true do
|
55
53
|
manifestation = NdlBook.import_from_sru_response('21859930')
|
56
54
|
manifestation.title_alternative.should eq 'PLATINADATA'
|
57
55
|
manifestation.title_alternative_transcription.should eq 'PLATINA DATA'
|
58
56
|
end
|
59
57
|
|
60
|
-
it "should import series_statement" do
|
58
|
+
it "should import series_statement", :vcr => true do
|
61
59
|
manifestation = NdlBook.import_from_sru_response('20408556')
|
62
60
|
manifestation.original_title.should eq "ズッコケ三人組のダイエット講座"
|
63
61
|
manifestation.series_statement.original_title.should eq "ポプラ社文庫. ズッコケ文庫"
|
64
62
|
manifestation.series_statement.periodical.should be_false
|
65
63
|
end
|
66
64
|
|
67
|
-
it "should import series_statement if the resource is periodical" do
|
65
|
+
it "should import series_statement if the resource is periodical", :vcr => true do
|
68
66
|
manifestation = NdlBook.import_from_sru_response('00010852')
|
69
67
|
manifestation.original_title.should eq "週刊新潮"
|
70
68
|
manifestation.series_statement.original_title.should eq "週刊新潮"
|
71
69
|
manifestation.series_statement.periodical.should be_true
|
72
|
-
|
70
|
+
end
|
73
71
|
|
74
|
-
it "should import pud_date is nil" do
|
72
|
+
it "should import pud_date is nil", :vcr => true do
|
75
73
|
manifestation = NdlBook.import_from_sru_response('00018082')
|
76
74
|
manifestation.original_title.should eq "西日本哲学会会報"
|
77
75
|
manifestation.pub_date.should be_nil
|
78
76
|
end
|
79
77
|
|
80
|
-
it "should import url contain whitespace" do
|
78
|
+
it "should import url contain whitespace", :vcr => true do
|
81
79
|
manifestation = NdlBook.import_from_sru_response('91044453')
|
82
80
|
manifestation.original_title.should eq "ザ・スコット・フィッツジェラルド・ブック"
|
83
81
|
manifestation.pub_date.should eq "1991-04"
|
84
82
|
end
|
85
83
|
|
86
|
-
it "should import audio cd" do
|
84
|
+
it "should import audio cd", :vcr => true do
|
87
85
|
manifestation = NdlBook.import_from_sru_response('21620217')
|
88
86
|
manifestation.original_title.should eq "劇場版天元突破グレンラガン螺巌篇サウンドトラック・プラス"
|
89
87
|
manifestation.manifestation_content_type.name.should eq 'audio'
|
90
88
|
end
|
91
89
|
|
92
|
-
it "should import video dvd" do
|
90
|
+
it "should import video dvd", :vcr => true do
|
93
91
|
manifestation = NdlBook.import_from_sru_response('21374190')
|
94
92
|
manifestation.original_title.should eq "天元突破グレンラガン"
|
95
93
|
manifestation.manifestation_content_type.name.should eq 'video'
|
96
94
|
end
|
97
95
|
|
98
|
-
it "should not get volume number if book has not volume" do
|
96
|
+
it "should not get volume number if book has not volume", :vcr => true do
|
99
97
|
NdlBook.search('978-4-04-874013-5')[:items].first.title.should eq "天地明察"
|
100
98
|
end
|
101
99
|
|
102
|
-
it "should get volume number" do
|
100
|
+
it "should get volume number", :vcr => true do
|
103
101
|
NdlBook.search('978-4-04-100292-6')[:items].first.volume.should eq "下"
|
104
102
|
end
|
105
103
|
|
106
|
-
it "should not get volume number if book has not volume" do
|
104
|
+
it "should not get volume number if book has not volume", :vcr => true do
|
107
105
|
NdlBook.search('978-4-04-874013-5')[:items].first.volume.should eq ""
|
108
106
|
end
|
109
107
|
|
110
|
-
it "should get series title" do
|
108
|
+
it "should get series title", :vcr => true do
|
111
109
|
book = NdlBook.search("4840114404")[:items].first
|
112
110
|
book.series_title.should eq "マジック・ツリーハウス ; 15"
|
113
111
|
end
|
114
112
|
|
115
|
-
it "should not get series title if book has not series title" do
|
113
|
+
it "should not get series title if book has not series title", :vcr => true do
|
116
114
|
book = NdlBook.search("4788509105")[:items].first
|
117
115
|
book.series_title.should eq ""
|
118
116
|
end
|
@@ -3,9 +3,8 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe Question do
|
5
5
|
fixtures :all
|
6
|
-
use_vcr_cassette "enju_ndl/crd", :record => :new_episodes
|
7
6
|
|
8
|
-
it "should respond to search_crd" do
|
7
|
+
it "should respond to search_crd", :vcr => true do
|
9
8
|
Question.search_crd(:query_01 => 'library')
|
10
9
|
end
|
11
10
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -30,10 +30,16 @@ RSpec.configure do |config|
|
|
30
30
|
# examples within a transaction, remove the following line or assign false
|
31
31
|
# instead of true.
|
32
32
|
config.use_transactional_fixtures = true
|
33
|
-
config.extend VCR::RSpec::Macros
|
34
33
|
config.extend ControllerMacros, :type => :controller
|
35
34
|
|
36
35
|
config.before do
|
37
36
|
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
|
38
37
|
end
|
39
38
|
end
|
39
|
+
|
40
|
+
VCR.configure do |c|
|
41
|
+
c.cassette_library_dir = 'spec/cassette_library'
|
42
|
+
c.hook_into :fakeweb
|
43
|
+
c.configure_rspec_metadata!
|
44
|
+
c.allow_http_connections_when_no_cassette = true
|
45
|
+
end
|