enju_ndl 0.2.0.beta.2 → 0.2.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/lib/enju_ndl/ndl_search.rb +9 -2
  3. data/lib/enju_ndl/version.rb +1 -1
  4. data/spec/cassette_library/NdlBook/import/should_import_even_with_invalid_url.yml +174 -0
  5. data/spec/controllers/ndl_books_controller_spec.rb +1 -1
  6. data/spec/dummy/app/models/user.rb +2 -0
  7. data/spec/dummy/db/migrate/059_create_libraries.rb +7 -9
  8. data/spec/dummy/db/migrate/069_create_shelves.rb +3 -4
  9. data/spec/dummy/db/migrate/080_create_library_groups.rb +2 -3
  10. data/spec/dummy/db/migrate/120_create_baskets.rb +2 -3
  11. data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +4 -7
  12. data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +4 -5
  13. data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +3 -6
  14. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
  15. data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +2 -2
  16. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +1 -2
  17. data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +1 -1
  18. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +1 -1
  19. data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +1 -1
  20. data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +1 -1
  21. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +1 -3
  22. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +3 -5
  23. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +19 -6
  24. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +15 -2
  25. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  26. data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
  27. data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
  28. data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
  29. data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
  30. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
  31. data/spec/dummy/db/schema.rb +26 -10
  32. data/spec/dummy/db/test.sqlite3 +0 -0
  33. data/spec/dummy/solr/conf/admin-extra.html +31 -0
  34. data/spec/dummy/solr/conf/elevate.xml +36 -0
  35. data/spec/dummy/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  36. data/spec/dummy/solr/conf/protwords.txt +21 -0
  37. data/spec/dummy/solr/conf/schema.xml +275 -0
  38. data/spec/dummy/solr/conf/scripts.conf +24 -0
  39. data/spec/dummy/solr/conf/solrconfig.xml +680 -0
  40. data/spec/dummy/solr/conf/spellings.txt +2 -0
  41. data/spec/dummy/solr/conf/stopwords.txt +58 -0
  42. data/spec/dummy/solr/conf/synonyms.txt +31 -0
  43. data/spec/dummy/solr/default/data/index/_1j.fdt +0 -0
  44. data/spec/dummy/solr/default/data/index/_1j.fdx +0 -0
  45. data/spec/dummy/solr/default/data/index/_1j.fnm +0 -0
  46. data/spec/dummy/solr/default/data/index/_1j.nvd +0 -0
  47. data/spec/dummy/solr/default/data/index/_1j.nvm +0 -0
  48. data/spec/dummy/solr/default/data/index/_1j.si +0 -0
  49. data/spec/dummy/solr/default/data/index/_1j_2.del +0 -0
  50. data/spec/dummy/solr/default/data/index/_1j_Lucene41_0.doc +0 -0
  51. data/spec/dummy/solr/default/data/index/_1j_Lucene41_0.pos +0 -0
  52. data/spec/dummy/solr/default/data/index/_1j_Lucene41_0.tim +0 -0
  53. data/spec/dummy/solr/default/data/index/_1j_Lucene41_0.tip +0 -0
  54. data/spec/dummy/solr/default/data/index/_1l.fdt +0 -0
  55. data/spec/dummy/solr/default/data/index/_1l.fdx +0 -0
  56. data/spec/dummy/solr/default/data/index/_1l.fnm +0 -0
  57. data/spec/dummy/solr/default/data/index/_1l.nvd +0 -0
  58. data/spec/dummy/solr/default/data/index/_1l.nvm +0 -0
  59. data/spec/dummy/solr/default/data/index/_1l.si +0 -0
  60. data/spec/dummy/solr/default/data/index/_1l_1.del +0 -0
  61. data/spec/dummy/solr/default/data/index/_1l_Lucene41_0.doc +0 -0
  62. data/spec/dummy/solr/default/data/index/_1l_Lucene41_0.pos +0 -0
  63. data/spec/dummy/solr/default/data/index/_1l_Lucene41_0.tim +0 -0
  64. data/spec/dummy/solr/default/data/index/_1l_Lucene41_0.tip +0 -0
  65. data/spec/dummy/solr/default/data/index/segments.gen +0 -0
  66. data/spec/dummy/solr/default/data/index/segments_29 +0 -0
  67. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000068 +0 -0
  68. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000070 +0 -0
  69. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000072 +0 -0
  70. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000073 +0 -0
  71. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000074 +0 -0
  72. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000075 +0 -0
  73. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000076 +0 -0
  74. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000077 +0 -0
  75. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000078 +0 -0
  76. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000079 +0 -0
  77. data/spec/dummy/solr/development/data/index/segments.gen +0 -0
  78. data/spec/dummy/solr/development/data/index/segments_1 +0 -0
  79. data/spec/dummy/solr/solr.xml +8 -0
  80. data/spec/dummy/solr/test/data/index/segments.gen +0 -0
  81. data/spec/dummy/solr/test/data/index/segments_1 +0 -0
  82. data/spec/fixtures/library_groups.yml +1 -1
  83. data/spec/models/import_request_spec.rb +1 -1
  84. data/spec/models/manifestation_spec.rb +1 -1
  85. data/spec/models/ndl_book_spec.rb +11 -1
  86. data/spec/models/question_spec.rb +1 -1
  87. data/spec/rails_helper.rb +61 -0
  88. data/spec/requests/ndl_books_spec.rb +1 -1
  89. data/spec/spec_helper.rb +83 -52
  90. metadata +415 -303
  91. data/spec/dummy/config/initializers/enju_leaf.rb +0 -1
  92. data/spec/dummy/db/migrate/20160813130535_add_email_to_library_group.rb +0 -5
@@ -0,0 +1,58 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ #-----------------------------------------------------------------------
17
+ # a couple of test stopwords to test that the words are really being
18
+ # configured from this file:
19
+ stopworda
20
+ stopwordb
21
+
22
+ #Standard english stop words taken from Lucene's StopAnalyzer
23
+ a
24
+ an
25
+ and
26
+ are
27
+ as
28
+ at
29
+ be
30
+ but
31
+ by
32
+ for
33
+ if
34
+ in
35
+ into
36
+ is
37
+ it
38
+ no
39
+ not
40
+ of
41
+ on
42
+ or
43
+ s
44
+ such
45
+ t
46
+ that
47
+ the
48
+ their
49
+ then
50
+ there
51
+ these
52
+ they
53
+ this
54
+ to
55
+ was
56
+ will
57
+ with
58
+
@@ -0,0 +1,31 @@
1
+ # The ASF licenses this file to You under the Apache License, Version 2.0
2
+ # (the "License"); you may not use this file except in compliance with
3
+ # the License. You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ #-----------------------------------------------------------------------
14
+ #some test synonym mappings unlikely to appear in real input text
15
+ aaa => aaaa
16
+ bbb => bbbb1 bbbb2
17
+ ccc => cccc1,cccc2
18
+ a\=>a => b\=>b
19
+ a\,a => b\,b
20
+ fooaaa,baraaa,bazaaa
21
+
22
+ # Some synonym groups specific to this example
23
+ GB,gib,gigabyte,gigabytes
24
+ MB,mib,megabyte,megabytes
25
+ Television, Televisions, TV, TVs
26
+ #notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
27
+ #after us won't split it into two words.
28
+
29
+ # Synonym mappings can be used for spelling correction too
30
+ pixima => pixma
31
+
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <solr persistent="false">
3
+ <cores adminPath="/admin/cores" host="${host:}" hostPort="${jetty.port:}">
4
+ <core name="default" instanceDir="." dataDir="default/data"/>
5
+ <core name="development" instanceDir="." dataDir="development/data"/>
6
+ <core name="test" instanceDir="." dataDir="test/data"/>
7
+ </cores>
8
+ </solr>
@@ -7,7 +7,7 @@ one:
7
7
  note:
8
8
  my_networks: 0.0.0.0/0
9
9
  url: "http://localhost:3000/"
10
-
10
+ user_id: 1
11
11
 
12
12
  # == Schema Information
13
13
  #
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe ImportRequest do
5
5
  fixtures :all
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe Manifestation do
5
5
  fixtures :all
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe NdlBook do
5
5
  fixtures :all
@@ -38,6 +38,8 @@ describe NdlBook do
38
38
  manifestation.subjects.first.subject_heading_type.name.should eq 'ndlsh'
39
39
  manifestation.subjects.first.term.should eq 'プログラミング (コンピュータ)'
40
40
  manifestation.statement_of_responsibility.should eq '秋葉拓哉, 岩田陽一, 北川宜稔 著; Usu-ya 編'
41
+ manifestation.extent.should eq "315p"
42
+ manifestation.dimensions.should eq "24cm"
41
43
  end
42
44
 
43
45
  it "should import bibliographic record that does not have any classifications", :vcr => true do
@@ -193,5 +195,13 @@ describe NdlBook do
193
195
  manifestation.original_title.should eq "じゃらん 関東・東北"
194
196
  manifestation.title_transcription.should eq "ジャラン カントウ トウホク"
195
197
  end
198
+
199
+ it "should import even with invalid url", vcr: true do
200
+ manifestation = NdlBook.import_from_sru_response( "R100000002-I000003523406-00 " )
201
+ expect(manifestation.original_title).to eq "The little boat / written by Kathy Henderson ; illustrated by Patrick Benson"
202
+ expect(manifestation.language.name).to eq "English"
203
+ expect(manifestation.extent).to eq "1 v. (unpaged) : col. ill."
204
+ expect(manifestation.dimensions).to eq "25 x 29 cm"
205
+ end
196
206
  end
197
207
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'spec_helper'
2
+ require 'rails_helper'
3
3
 
4
4
  describe Question do
5
5
  fixtures :all
@@ -0,0 +1,61 @@
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("../dummy/config/environment", __FILE__)
9
+ require 'rspec/rails'
10
+ require 'vcr'
11
+ require 'sunspot-rails-tester'
12
+
13
+ # Requires supporting ruby files with custom matchers and macros, etc,
14
+ # in spec/support/ and its subdirectories.
15
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
16
+
17
+ $original_sunspot_session = Sunspot.session
18
+
19
+ RSpec.configure do |config|
20
+ # == Mock Framework
21
+ #
22
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
23
+ #
24
+ # config.mock_with :mocha
25
+ # config.mock_with :flexmock
26
+ # config.mock_with :rr
27
+ config.mock_with :rspec
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
36
+ config.extend ControllerMacros, :type => :controller
37
+
38
+ config.before do
39
+ Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
40
+ end
41
+ config.before :each, :solr => true do
42
+ Sunspot::Rails::Tester.start_original_sunspot_session
43
+ Sunspot.session = $original_sunspot_session
44
+ Sunspot.remove_all!
45
+ end
46
+
47
+ config.infer_spec_type_from_file_location!
48
+
49
+ config.include Warden::Test::Helpers
50
+ config.before :suite do
51
+ Warden.test_mode!
52
+ end
53
+ end
54
+
55
+ VCR.configure do |c|
56
+ c.cassette_library_dir = 'spec/cassette_library'
57
+ c.hook_into :webmock
58
+ c.configure_rspec_metadata!
59
+ c.allow_http_connections_when_no_cassette = true
60
+ c.ignore_localhost = true
61
+ end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe "NdlBooks" do
4
4
  describe "GET /ndl_books" do
data/spec/spec_helper.rb CHANGED
@@ -1,61 +1,92 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
- SimpleCov.start 'rails'
4
- Coveralls.wear!
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
19
+ RSpec.configure do |config|
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
5
33
 
6
- # This file is copied to spec/ when you run 'rails generate rspec:install'
7
- ENV["RAILS_ENV"] ||= 'test'
8
- require File.expand_path("../dummy/config/environment", __FILE__)
9
- require 'rspec/rails'
10
- require 'vcr'
11
- require 'sunspot-rails-tester'
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
12
42
 
13
- # Requires supporting ruby files with custom matchers and macros, etc,
14
- # in spec/support/ and its subdirectories.
15
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
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
16
52
 
17
- $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"
18
57
 
19
- RSpec.configure do |config|
20
- # == Mock Framework
21
- #
22
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
23
- #
24
- # config.mock_with :mocha
25
- # config.mock_with :flexmock
26
- # config.mock_with :rr
27
- config.mock_with :rspec
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
36
- config.extend ControllerMacros, :type => :controller
37
-
38
- config.before do
39
- Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
40
- end
41
- config.before :each, :solr => true do
42
- Sunspot::Rails::Tester.start_original_sunspot_session
43
- Sunspot.session = $original_sunspot_session
44
- Sunspot.remove_all!
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!
64
+
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'
45
73
  end
46
74
 
47
- config.infer_spec_type_from_file_location!
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
48
79
 
49
- config.include Warden::Test::Helpers
50
- config.before :suite do
51
- Warden.test_mode!
52
- end
53
- end
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
54
85
 
55
- VCR.configure do |c|
56
- c.cassette_library_dir = 'spec/cassette_library'
57
- c.hook_into :webmock
58
- c.configure_rspec_metadata!
59
- c.allow_http_connections_when_no_cassette = true
60
- c.ignore_localhost = 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
61
92
  end