enju_nii 0.2.0.beta.2 → 0.2.0.beta.3
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 +4 -4
- data/lib/enju_nii/cinii_book.rb +47 -45
- data/lib/enju_nii/version.rb +1 -1
- data/spec/cassette_library/CiniiBook/should_import_a_bibliographic_record.yml +345 -346
- data/spec/controllers/cinii_books_controller_spec.rb +1 -1
- data/spec/controllers/nii_types_controller_spec.rb +2 -2
- data/spec/dummy/app/models/user.rb +2 -0
- data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
- data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
- data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
- data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
- data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
- data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +18 -0
- data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +18 -0
- data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -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/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 +78 -5
- data/spec/fixtures/library_groups.yml +1 -1
- data/spec/models/cinii_book_spec.rb +3 -1
- data/spec/rails_helper.rb +49 -0
- data/spec/spec_helper.rb +84 -41
- metadata +216 -192
- data/spec/dummy/config/initializers/enju_leaf.rb +0 -2
- data/spec/dummy/db/migrate/20160813130535_add_email_to_library_group.rb +0 -5
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'rails_helper'
|
2
2
|
|
3
3
|
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
4
4
|
# It demonstrates how one might use RSpec to specify the controller code that
|
@@ -126,7 +126,7 @@ describe NiiTypesController do
|
|
126
126
|
position = nii_type.position
|
127
127
|
put :update, :id => nii_type.id, :move => 'higher'
|
128
128
|
expect(response).to redirect_to nii_types_url
|
129
|
-
assigns(:nii_type).position.should eq position - 1
|
129
|
+
assigns(:nii_type).reload.position.should eq position - 1
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateMessageTemplates < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :message_templates do |t|
|
4
|
+
t.string :status, :null => false
|
5
|
+
t.text :title, :null => false
|
6
|
+
t.text :body, :null => false
|
7
|
+
t.integer :position
|
8
|
+
t.string :locale, :default => I18n.default_locale.to_s
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
add_index :message_templates, :status, :unique => true
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :message_templates
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateMessages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :messages, :force => true do |t|
|
4
|
+
t.datetime :read_at
|
5
|
+
t.integer :receiver_id, :sender_id
|
6
|
+
t.string :subject, :null => false
|
7
|
+
t.text :body
|
8
|
+
t.integer :message_request_id
|
9
|
+
t.integer :parent_id
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :messages, :sender_id
|
15
|
+
add_index :messages, :receiver_id
|
16
|
+
add_index :messages, :message_request_id
|
17
|
+
add_index :messages, :parent_id
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
drop_table :messages
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateMessageRequests < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :message_requests do |t|
|
4
|
+
t.integer :sender_id
|
5
|
+
t.integer :receiver_id
|
6
|
+
t.integer :message_template_id
|
7
|
+
t.datetime :sent_at
|
8
|
+
t.datetime :deleted_at
|
9
|
+
t.text :body
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :message_requests
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateMessageTransitions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :message_transitions do |t|
|
4
|
+
t.string :to_state
|
5
|
+
if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
|
6
|
+
t.text :metadata
|
7
|
+
else
|
8
|
+
t.text :metadata, default: "{}"
|
9
|
+
end
|
10
|
+
t.integer :sort_key
|
11
|
+
t.integer :message_id
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :message_transitions, :message_id
|
16
|
+
add_index :message_transitions, [:sort_key, :message_id], unique: true
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateMessageRequestTransitions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :message_request_transitions do |t|
|
4
|
+
t.string :to_state
|
5
|
+
if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
|
6
|
+
t.text :metadata
|
7
|
+
else
|
8
|
+
t.text :metadata, default: "{}"
|
9
|
+
end
|
10
|
+
t.integer :sort_key
|
11
|
+
t.integer :message_request_id
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :message_request_transitions, :message_request_id
|
16
|
+
add_index :message_request_transitions, [:sort_key, :message_request_id], unique: true, name: "index_message_request_transitions_on_sort_key_and_request_id"
|
17
|
+
end
|
18
|
+
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20160814165332) do
|
15
15
|
|
16
16
|
create_table "accepts", force: :cascade do |t|
|
17
17
|
t.integer "basket_id"
|
@@ -473,9 +473,9 @@ ActiveRecord::Schema.define(version: 20160813130535) do
|
|
473
473
|
add_index "library_group_translations", ["locale"], name: "index_library_group_translations_on_locale"
|
474
474
|
|
475
475
|
create_table "library_groups", force: :cascade do |t|
|
476
|
-
t.string "name",
|
476
|
+
t.string "name", null: false
|
477
477
|
t.text "display_name"
|
478
|
-
t.string "short_name",
|
478
|
+
t.string "short_name", null: false
|
479
479
|
t.text "my_networks"
|
480
480
|
t.text "login_banner"
|
481
481
|
t.text "note"
|
@@ -484,13 +484,17 @@ ActiveRecord::Schema.define(version: 20160813130535) do
|
|
484
484
|
t.datetime "created_at"
|
485
485
|
t.datetime "updated_at"
|
486
486
|
t.text "admin_networks"
|
487
|
-
t.string "url",
|
487
|
+
t.string "url", default: "http://localhost:3000/"
|
488
488
|
t.text "settings"
|
489
489
|
t.text "html_snippet"
|
490
|
-
t.
|
490
|
+
t.integer "max_number_of_results", default: 500
|
491
|
+
t.boolean "family_name_first", default: true
|
492
|
+
t.integer "pub_year_facet_range_interval", default: 10
|
493
|
+
t.integer "user_id"
|
491
494
|
end
|
492
495
|
|
493
496
|
add_index "library_groups", ["short_name"], name: "index_library_groups_on_short_name"
|
497
|
+
add_index "library_groups", ["user_id"], name: "index_library_groups_on_user_id"
|
494
498
|
|
495
499
|
create_table "licenses", force: :cascade do |t|
|
496
500
|
t.string "name", null: false
|
@@ -601,6 +605,75 @@ ActiveRecord::Schema.define(version: 20160813130535) do
|
|
601
605
|
t.datetime "updated_at"
|
602
606
|
end
|
603
607
|
|
608
|
+
create_table "message_request_transitions", force: :cascade do |t|
|
609
|
+
t.string "to_state"
|
610
|
+
t.text "metadata", default: "{}"
|
611
|
+
t.integer "sort_key"
|
612
|
+
t.integer "message_request_id"
|
613
|
+
t.datetime "created_at"
|
614
|
+
t.datetime "updated_at"
|
615
|
+
t.boolean "most_recent"
|
616
|
+
end
|
617
|
+
|
618
|
+
add_index "message_request_transitions", ["message_request_id"], name: "index_message_request_transitions_on_message_request_id"
|
619
|
+
add_index "message_request_transitions", ["sort_key", "message_request_id"], name: "index_message_request_transitions_on_sort_key_and_request_id", unique: true
|
620
|
+
|
621
|
+
create_table "message_requests", force: :cascade do |t|
|
622
|
+
t.integer "sender_id"
|
623
|
+
t.integer "receiver_id"
|
624
|
+
t.integer "message_template_id"
|
625
|
+
t.datetime "sent_at"
|
626
|
+
t.datetime "deleted_at"
|
627
|
+
t.text "body"
|
628
|
+
t.datetime "created_at"
|
629
|
+
t.datetime "updated_at"
|
630
|
+
end
|
631
|
+
|
632
|
+
create_table "message_templates", force: :cascade do |t|
|
633
|
+
t.string "status", null: false
|
634
|
+
t.text "title", null: false
|
635
|
+
t.text "body", null: false
|
636
|
+
t.integer "position"
|
637
|
+
t.string "locale", default: "en"
|
638
|
+
t.datetime "created_at"
|
639
|
+
t.datetime "updated_at"
|
640
|
+
end
|
641
|
+
|
642
|
+
add_index "message_templates", ["status"], name: "index_message_templates_on_status", unique: true
|
643
|
+
|
644
|
+
create_table "message_transitions", force: :cascade do |t|
|
645
|
+
t.string "to_state"
|
646
|
+
t.text "metadata", default: "{}"
|
647
|
+
t.integer "sort_key"
|
648
|
+
t.integer "message_id"
|
649
|
+
t.datetime "created_at"
|
650
|
+
t.datetime "updated_at"
|
651
|
+
t.boolean "most_recent"
|
652
|
+
end
|
653
|
+
|
654
|
+
add_index "message_transitions", ["message_id"], name: "index_message_transitions_on_message_id"
|
655
|
+
add_index "message_transitions", ["sort_key", "message_id"], name: "index_message_transitions_on_sort_key_and_message_id", unique: true
|
656
|
+
|
657
|
+
create_table "messages", force: :cascade do |t|
|
658
|
+
t.datetime "read_at"
|
659
|
+
t.integer "receiver_id"
|
660
|
+
t.integer "sender_id"
|
661
|
+
t.string "subject", null: false
|
662
|
+
t.text "body"
|
663
|
+
t.integer "message_request_id"
|
664
|
+
t.integer "parent_id"
|
665
|
+
t.datetime "created_at"
|
666
|
+
t.datetime "updated_at"
|
667
|
+
t.integer "lft"
|
668
|
+
t.integer "rgt"
|
669
|
+
t.integer "depth"
|
670
|
+
end
|
671
|
+
|
672
|
+
add_index "messages", ["message_request_id"], name: "index_messages_on_message_request_id"
|
673
|
+
add_index "messages", ["parent_id"], name: "index_messages_on_parent_id"
|
674
|
+
add_index "messages", ["receiver_id"], name: "index_messages_on_receiver_id"
|
675
|
+
add_index "messages", ["sender_id"], name: "index_messages_on_sender_id"
|
676
|
+
|
604
677
|
create_table "nii_types", force: :cascade do |t|
|
605
678
|
t.string "name", null: false
|
606
679
|
t.text "display_name"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require '
|
2
|
+
require 'rails_helper'
|
3
3
|
|
4
4
|
describe CiniiBook do
|
5
5
|
fixtures :all
|
@@ -28,6 +28,8 @@ describe CiniiBook do
|
|
28
28
|
book.publishers.first.full_name.should eq "大阪大学出版会"
|
29
29
|
book.language.iso_639_2.should eq "jpn"
|
30
30
|
book.date_of_publication.year.should eq 2008
|
31
|
+
book.extent.should eq "iv, 144p"
|
32
|
+
book.dimensions.should eq "21cm"
|
31
33
|
book.identifier_contents("isbn").first.should eq "9784872592542"
|
32
34
|
book.identifier_contents("ncid").first.should eq "BA85746967"
|
33
35
|
book.creators.size.should eq 2
|
@@ -0,0 +1,49 @@
|
|
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
|
+
|
12
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
13
|
+
# in spec/support/ and its subdirectories.
|
14
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
15
|
+
|
16
|
+
$original_sunspot_session = Sunspot.session
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# == Mock Framework
|
20
|
+
#
|
21
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
22
|
+
#
|
23
|
+
# config.mock_with :mocha
|
24
|
+
# config.mock_with :flexmock
|
25
|
+
# config.mock_with :rr
|
26
|
+
config.mock_with :rspec
|
27
|
+
|
28
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
29
|
+
config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
|
30
|
+
|
31
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
32
|
+
# examples within a transaction, remove the following line or assign false
|
33
|
+
# instead of true.
|
34
|
+
config.use_transactional_fixtures = true
|
35
|
+
config.extend ControllerMacros, :type => :controller
|
36
|
+
|
37
|
+
config.before do
|
38
|
+
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
|
39
|
+
end
|
40
|
+
|
41
|
+
config.infer_spec_type_from_file_location!
|
42
|
+
end
|
43
|
+
|
44
|
+
VCR.configure do |c|
|
45
|
+
c.cassette_library_dir = 'spec/cassette_library'
|
46
|
+
c.hook_into :webmock
|
47
|
+
c.configure_rspec_metadata!
|
48
|
+
c.allow_http_connections_when_no_cassette = true
|
49
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,49 +1,92 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
11
42
|
|
12
|
-
#
|
13
|
-
#
|
14
|
-
|
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
|
15
52
|
|
16
|
-
|
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"
|
17
57
|
|
18
|
-
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
# instead of true.
|
34
|
-
config.use_transactional_fixtures = true
|
35
|
-
config.extend ControllerMacros, :type => :controller
|
36
|
-
|
37
|
-
config.before do
|
38
|
-
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
|
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'
|
39
73
|
end
|
40
74
|
|
41
|
-
|
42
|
-
end
|
75
|
+
# Print the 10 slowest examples and example groups at the
|
76
|
+
# end of the spec run, to help surface which specs are running
|
77
|
+
# particularly slow.
|
78
|
+
config.profile_examples = 10
|
79
|
+
|
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
|
43
85
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
49
92
|
end
|