enju_biblio 0.3.8 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/content_types_controller.rb +1 -1
- data/app/controllers/item_custom_properties_controller.rb +69 -0
- data/app/controllers/items_controller.rb +2 -3
- data/app/controllers/manifestation_custom_properties_controller.rb +69 -0
- data/app/controllers/manifestations_controller.rb +12 -15
- data/app/controllers/resource_import_results_controller.rb +6 -2
- data/app/models/agent.rb +6 -6
- data/app/models/agent_import_file.rb +7 -7
- data/app/models/agent_type.rb +0 -1
- data/app/models/carrier_type.rb +0 -1
- data/app/models/content_type.rb +0 -1
- data/app/models/form_of_work.rb +1 -2
- data/app/models/frequency.rb +0 -1
- data/app/models/identifier_type.rb +0 -1
- data/app/models/item.rb +15 -16
- data/app/models/item_custom_property.rb +18 -0
- data/app/models/item_custom_value.rb +17 -0
- data/app/models/license.rb +0 -1
- data/app/models/manifestation.rb +54 -22
- data/app/models/manifestation_custom_property.rb +18 -0
- data/app/models/manifestation_custom_value.rb +17 -0
- data/app/models/medium_of_performance.rb +1 -2
- data/app/models/picture_file.rb +0 -2
- data/app/models/resource_export_file.rb +4 -2
- data/app/models/resource_import_file.rb +157 -67
- data/app/policies/item_custom_property_policy.rb +21 -0
- data/app/policies/manifestation_custom_property_policy.rb +21 -0
- data/app/views/agent_import_results/index.txt.ruby +5 -0
- data/app/views/agent_relationship_types/_form.html.erb +1 -1
- data/app/views/agent_types/_form.html.erb +1 -1
- data/app/views/carrier_types/_form.html.erb +1 -1
- data/app/views/create_types/_form.html.erb +1 -1
- data/app/views/form_of_works/_form.html.erb +1 -1
- data/app/views/frequencies/_form.html.erb +1 -1
- data/app/views/item_custom_properties/_form.html.erb +32 -0
- data/app/views/item_custom_properties/edit.html.erb +13 -0
- data/app/views/item_custom_properties/index.html.erb +43 -0
- data/app/views/item_custom_properties/new.html.erb +12 -0
- data/app/views/item_custom_properties/show.html.erb +28 -0
- data/app/views/items/_form.html.erb +13 -10
- data/app/views/items/show.html.erb +3 -4
- data/app/views/licenses/_form.html.erb +1 -1
- data/app/views/manifestation_custom_properties/_form.html.erb +32 -0
- data/app/views/manifestation_custom_properties/edit.html.erb +13 -0
- data/app/views/manifestation_custom_properties/index.html.erb +43 -0
- data/app/views/manifestation_custom_properties/new.html.erb +12 -0
- data/app/views/manifestation_custom_properties/show.html.erb +28 -0
- data/app/views/manifestation_relationship_types/_form.html.erb +1 -1
- data/app/views/manifestations/_export_detail.html.erb +1 -0
- data/app/views/manifestations/_export_list.html.erb +1 -0
- data/app/views/manifestations/_form.html.erb +18 -10
- data/app/views/manifestations/_show_detail_librarian.html.erb +9 -3
- data/app/views/manifestations/_show_detail_user.html.erb +8 -0
- data/app/views/manifestations/show.json.jbuilder +2 -0
- data/app/views/medium_of_performances/_form.html.erb +1 -1
- data/app/views/picture_files/edit.html.erb +4 -0
- data/app/views/produce_types/_form.html.erb +1 -1
- data/app/views/realize_types/_form.html.erb +1 -1
- data/app/views/resource_import_results/index.txt.ruby +5 -0
- data/app/views/series_statement_merges/_form.html.erb +1 -1
- data/config/locales/translation_en.yml +22 -8
- data/config/locales/translation_ja.yml +22 -8
- data/config/routes.rb +2 -0
- data/db/migrate/20081027150907_create_picture_files.rb +0 -2
- data/db/migrate/20200425072340_create_manifestation_custom_properties.rb +12 -0
- data/db/migrate/20200425072349_create_item_custom_properties.rb +12 -0
- data/db/migrate/20200425074758_create_manifestation_custom_values.rb +12 -0
- data/db/migrate/20200425074822_create_item_custom_values.rb +12 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_import_custom_values.yml +121 -0
- data/spec/cassette_library/resource_import_results/index_txt_ruby/renders_a_list_of_resource_import_results.yml +121 -0
- data/spec/controllers/content_types_controller_spec.rb +1 -1
- data/spec/controllers/item_custom_properties_controller_spec.rb +449 -0
- data/spec/controllers/items_controller_spec.rb +22 -25
- data/spec/controllers/manifestation_custom_properties_controller_spec.rb +449 -0
- data/spec/controllers/manifestations_controller_spec.rb +20 -23
- data/spec/dummy/db/schema.rb +43 -12
- data/spec/factories/item_custom_property.rb +6 -0
- data/spec/factories/item_custom_value.rb +6 -0
- data/spec/factories/manifestation_custom_property.rb +6 -0
- data/spec/factories/manifestation_custom_value.rb +6 -0
- data/spec/fixtures/creates.yml +2 -0
- data/spec/fixtures/item_custom_properties.yml +24 -0
- data/spec/fixtures/library_groups.yml +29 -15
- data/spec/fixtures/manifestation_custom_properties.yml +24 -0
- data/spec/fixtures/picture_files.yml +0 -2
- data/spec/fixtures/produces.yml +2 -0
- data/spec/fixtures/realizes.yml +2 -0
- data/spec/fixtures/resource_import_results.yml +2 -2
- data/spec/models/item_custom_property_spec.rb +18 -0
- data/spec/models/item_custom_value_spec.rb +17 -0
- data/spec/models/manifestation_custom_property_spec.rb +18 -0
- data/spec/models/manifestation_custom_value_spec.rb +17 -0
- data/spec/models/manifestation_spec.rb +11 -21
- data/spec/models/picture_file_spec.rb +0 -2
- data/spec/models/resource_export_file_spec.rb +61 -8
- data/spec/models/resource_import_file_spec.rb +43 -13
- data/spec/requests/item_custom_properties_spec.rb +129 -0
- data/spec/requests/manifestation_custom_properties_spec.rb +129 -0
- data/spec/routing/item_custom_properties_routing_spec.rb +38 -0
- data/spec/routing/manifestation_custom_properties_routing_spec.rb +38 -0
- data/spec/system/items_spec.rb +12 -0
- data/spec/system/manifestations_spec.rb +12 -0
- data/spec/views/agent_import_results/index.html.erb_spec.rb +29 -0
- data/spec/views/agent_import_results/index.txt.ruby_spec.rb +20 -0
- data/spec/views/agent_import_results/show.html.erb_spec.rb +24 -0
- data/spec/views/item_custom_properties/edit.html.erb_spec.rb +21 -0
- data/spec/views/item_custom_properties/index.html.erb_spec.rb +25 -0
- data/spec/views/item_custom_properties/new.html.erb_spec.rb +21 -0
- data/spec/views/item_custom_properties/show.html.erb_spec.rb +16 -0
- data/spec/views/manifestation_custom_properties/edit.html.erb_spec.rb +21 -0
- data/spec/views/manifestation_custom_properties/index.html.erb_spec.rb +25 -0
- data/spec/views/manifestation_custom_properties/new.html.erb_spec.rb +21 -0
- data/spec/views/manifestation_custom_properties/show.html.erb_spec.rb +16 -0
- data/spec/views/manifestations/show.json.jbuilder_spec.rb +16 -0
- data/spec/views/manifestations/show.txt.ruby_spec.rb +1 -1
- data/spec/views/resource_import_results/index.txt.ruby_spec.rb +22 -0
- data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
- metadata +118 -37
- data/app/models/custom_property.rb +0 -17
- data/app/views/agent_import_results/index.txt.erb +0 -3
- data/app/views/items/_custom_property_fields.html.erb +0 -7
- data/app/views/manifestations/_custom_property_fields.html.erb +0 -7
- data/app/views/resource_import_results/index.txt.erb +0 -3
- data/db/migrate/20191219122214_create_custom_properties.rb +0 -12
- data/spec/factories/custom_property.rb +0 -18
- data/spec/models/custom_property_spec.rb +0 -18
- data/spec/system/custom_properties_spec.rb +0 -84
@@ -575,6 +575,12 @@ describe ManifestationsController do
|
|
575
575
|
post :create, params: { manifestation: @attrs.merge(attachment: fixture_file_upload('/../../examples/resource_import_file_sample1.tsv', 'text/csv')) }
|
576
576
|
expect(assigns(:manifestation)).to be_valid
|
577
577
|
end
|
578
|
+
|
579
|
+
it 'accepts custom values' do
|
580
|
+
post :create, params: { manifestation: @attrs.merge(manifestation_custom_values_attributes: Array.new(3){FactoryBot.attributes_for(:manifestation_custom_value, manifestation_custom_property_id: FactoryBot.create(:manifestation_custom_property).id)}) }
|
581
|
+
expect(assigns(:manifestation)).to be_valid
|
582
|
+
expect(assigns(:manifestation).manifestation_custom_values.count).to eq 3
|
583
|
+
end
|
578
584
|
end
|
579
585
|
|
580
586
|
describe 'with invalid params' do
|
@@ -717,17 +723,20 @@ describe ManifestationsController do
|
|
717
723
|
expect(assigns(:manifestation)).to eq @manifestation
|
718
724
|
end
|
719
725
|
|
720
|
-
it '
|
721
|
-
manifestation
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
726
|
+
it 'accepts custom values' do
|
727
|
+
@manifestation.manifestation_custom_values << FactoryBot.build(:manifestation_custom_value)
|
728
|
+
put :update, params: { id: @manifestation.id, manifestation: @attrs.merge(manifestation_custom_values_attributes: [{id: @manifestation.manifestation_custom_values.first.id, value: 'test'}]) }
|
729
|
+
expect(assigns(:manifestation)).to be_valid
|
730
|
+
expect(assigns(:manifestation).manifestation_custom_values.count).to eq 1
|
731
|
+
expect(assigns(:manifestation).manifestation_custom_values.first.value).to eq 'test'
|
732
|
+
end
|
733
|
+
|
734
|
+
it 'accepts custom values when the value is empty' do
|
735
|
+
@manifestation.manifestation_custom_values << FactoryBot.build(:manifestation_custom_value)
|
736
|
+
put :update, params: { id: @manifestation.id, manifestation: @attrs.merge(manifestation_custom_values_attributes: [{id: @manifestation.manifestation_custom_values.first.id, value: ''}]) }
|
737
|
+
expect(assigns(:manifestation)).to be_valid
|
738
|
+
expect(assigns(:manifestation).manifestation_custom_values.count).to eq 1
|
739
|
+
expect(assigns(:manifestation).manifestation_custom_values.first.value).to eq ''
|
731
740
|
end
|
732
741
|
end
|
733
742
|
|
@@ -754,18 +763,6 @@ describe ManifestationsController do
|
|
754
763
|
}
|
755
764
|
expect(assigns(:manifestation)).to_not be_valid
|
756
765
|
end
|
757
|
-
|
758
|
-
it 'assigns custom properties to @manifestation' do
|
759
|
-
manifestation = FactoryBot.create(:manifestation_custom_property).resource
|
760
|
-
custom_properties_attrs = {
|
761
|
-
custom_properties_attributes: [{name: 'test', value: 'テスト'}]
|
762
|
-
}
|
763
|
-
put :update, params: {
|
764
|
-
id: manifestation.id, manifestation: @invalid_attrs.merge(custom_properties_attrs)
|
765
|
-
}
|
766
|
-
expect(assigns(:manifestation).custom_properties.count).to eq 1
|
767
|
-
expect(assigns(:manifestation)).to_not be_valid
|
768
|
-
end
|
769
766
|
end
|
770
767
|
end
|
771
768
|
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 2020_04_25_074822) do
|
14
14
|
|
15
15
|
create_table "accepts", force: :cascade do |t|
|
16
16
|
t.integer "basket_id"
|
@@ -433,15 +433,6 @@ ActiveRecord::Schema.define(version: 2019_12_19_122214) do
|
|
433
433
|
t.index ["work_id"], name: "index_creates_on_work_id"
|
434
434
|
end
|
435
435
|
|
436
|
-
create_table "custom_properties", force: :cascade do |t|
|
437
|
-
t.integer "resource_id", null: false
|
438
|
-
t.string "resource_type", null: false
|
439
|
-
t.text "label", null: false
|
440
|
-
t.text "value"
|
441
|
-
t.datetime "created_at", null: false
|
442
|
-
t.datetime "updated_at", null: false
|
443
|
-
end
|
444
|
-
|
445
436
|
create_table "demands", force: :cascade do |t|
|
446
437
|
t.integer "user_id"
|
447
438
|
t.integer "item_id"
|
@@ -653,6 +644,27 @@ ActiveRecord::Schema.define(version: 2019_12_19_122214) do
|
|
653
644
|
t.index ["user_id"], name: "index_inventory_files_on_user_id"
|
654
645
|
end
|
655
646
|
|
647
|
+
create_table "item_custom_properties", force: :cascade do |t|
|
648
|
+
t.string "name", null: false
|
649
|
+
t.text "display_name", null: false
|
650
|
+
t.text "note"
|
651
|
+
t.integer "position", default: 1, null: false
|
652
|
+
t.datetime "created_at", null: false
|
653
|
+
t.datetime "updated_at", null: false
|
654
|
+
t.index ["name"], name: "index_item_custom_properties_on_name", unique: true
|
655
|
+
end
|
656
|
+
|
657
|
+
create_table "item_custom_values", force: :cascade do |t|
|
658
|
+
t.integer "item_custom_property_id", null: false
|
659
|
+
t.integer "item_id", null: false
|
660
|
+
t.text "value"
|
661
|
+
t.datetime "created_at", null: false
|
662
|
+
t.datetime "updated_at", null: false
|
663
|
+
t.index ["item_custom_property_id", "item_id"], name: "index_item_custom_values_on_custom_item_property_and_item_id", unique: true
|
664
|
+
t.index ["item_custom_property_id"], name: "index_item_custom_values_on_custom_property_id"
|
665
|
+
t.index ["item_id"], name: "index_item_custom_values_on_item_id"
|
666
|
+
end
|
667
|
+
|
656
668
|
create_table "item_has_use_restrictions", force: :cascade do |t|
|
657
669
|
t.integer "item_id", null: false
|
658
670
|
t.integer "use_restriction_id", null: false
|
@@ -831,6 +843,27 @@ ActiveRecord::Schema.define(version: 2019_12_19_122214) do
|
|
831
843
|
t.index ["user_id"], name: "index_manifestation_checkout_stats_on_user_id"
|
832
844
|
end
|
833
845
|
|
846
|
+
create_table "manifestation_custom_properties", force: :cascade do |t|
|
847
|
+
t.string "name", null: false
|
848
|
+
t.text "display_name", null: false
|
849
|
+
t.text "note"
|
850
|
+
t.integer "position", default: 1, null: false
|
851
|
+
t.datetime "created_at", null: false
|
852
|
+
t.datetime "updated_at", null: false
|
853
|
+
t.index ["name"], name: "index_manifestation_custom_properties_on_name", unique: true
|
854
|
+
end
|
855
|
+
|
856
|
+
create_table "manifestation_custom_values", force: :cascade do |t|
|
857
|
+
t.integer "manifestation_custom_property_id", null: false
|
858
|
+
t.integer "manifestation_id", null: false
|
859
|
+
t.text "value"
|
860
|
+
t.datetime "created_at", null: false
|
861
|
+
t.datetime "updated_at", null: false
|
862
|
+
t.index ["manifestation_custom_property_id", "manifestation_id"], name: "index_manifestation_custom_values_on_property_manifestation", unique: true
|
863
|
+
t.index ["manifestation_custom_property_id"], name: "index_manifestation_custom_values_on_custom_property_id"
|
864
|
+
t.index ["manifestation_id"], name: "index_manifestation_custom_values_on_manifestation_id"
|
865
|
+
end
|
866
|
+
|
834
867
|
create_table "manifestation_relationship_types", force: :cascade do |t|
|
835
868
|
t.string "name", null: false
|
836
869
|
t.text "display_name"
|
@@ -1039,9 +1072,7 @@ ActiveRecord::Schema.define(version: 2019_12_19_122214) do
|
|
1039
1072
|
create_table "picture_files", force: :cascade do |t|
|
1040
1073
|
t.integer "picture_attachable_id"
|
1041
1074
|
t.string "picture_attachable_type"
|
1042
|
-
t.string "content_type"
|
1043
1075
|
t.text "title"
|
1044
|
-
t.string "thumbnail"
|
1045
1076
|
t.integer "position"
|
1046
1077
|
t.datetime "created_at"
|
1047
1078
|
t.datetime "updated_at"
|
data/spec/fixtures/creates.yml
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
create_00001:
|
3
3
|
updated_at: 2007-12-13 19:56:07.002082 +09:00
|
4
4
|
agent_id: 1
|
5
|
+
create_type_id: 1
|
5
6
|
id: 1
|
6
7
|
work_id: 1
|
7
8
|
position: 1
|
@@ -9,6 +10,7 @@ create_00001:
|
|
9
10
|
create_00002:
|
10
11
|
updated_at: 2007-12-13 19:56:48.538796 +09:00
|
11
12
|
agent_id: 1
|
13
|
+
create_type_id: 1
|
12
14
|
id: 2
|
13
15
|
work_id: 2
|
14
16
|
position: 1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
one:
|
2
|
+
id: 1
|
3
|
+
name: custom_1
|
4
|
+
display_name: "カスタム項目1"
|
5
|
+
position: 1
|
6
|
+
|
7
|
+
two:
|
8
|
+
id: 2
|
9
|
+
name: custom_2
|
10
|
+
display_name: "カスタム項目1"
|
11
|
+
position: 2
|
12
|
+
|
13
|
+
# == Schema Information
|
14
|
+
#
|
15
|
+
# Table name: item_custom_properties
|
16
|
+
#
|
17
|
+
# id :integer not null, primary key
|
18
|
+
# name :string not null
|
19
|
+
# display_name :text not null
|
20
|
+
# note :text
|
21
|
+
# position :integer default(1), not null
|
22
|
+
# created_at :datetime not null
|
23
|
+
# updated_at :datetime not null
|
24
|
+
#
|
@@ -13,24 +13,38 @@ one:
|
|
13
13
|
admin_networks: "0.0.0.0/0\r\n\
|
14
14
|
::/0"
|
15
15
|
user_id: 1
|
16
|
-
|
17
|
-
family_name_first: true
|
16
|
+
pub_year_facet_range_interval: 10
|
18
17
|
|
19
18
|
# == Schema Information
|
20
19
|
#
|
21
20
|
# Table name: library_groups
|
22
21
|
#
|
23
|
-
# id
|
24
|
-
# name
|
25
|
-
# display_name
|
26
|
-
# short_name
|
27
|
-
# my_networks
|
28
|
-
#
|
29
|
-
# note
|
30
|
-
# country_id
|
31
|
-
# position
|
32
|
-
# created_at
|
33
|
-
# updated_at
|
34
|
-
# admin_networks
|
35
|
-
#
|
22
|
+
# id :integer not null, primary key
|
23
|
+
# name :string not null
|
24
|
+
# display_name :text
|
25
|
+
# short_name :string not null
|
26
|
+
# my_networks :text
|
27
|
+
# old_login_banner :text
|
28
|
+
# note :text
|
29
|
+
# country_id :integer
|
30
|
+
# position :integer
|
31
|
+
# created_at :datetime
|
32
|
+
# updated_at :datetime
|
33
|
+
# admin_networks :text
|
34
|
+
# allow_bookmark_external_url :boolean default(FALSE), not null
|
35
|
+
# url :string default("http://localhost:3000/")
|
36
|
+
# settings :text
|
37
|
+
# html_snippet :text
|
38
|
+
# book_jacket_source :string
|
39
|
+
# max_number_of_results :integer default(500)
|
40
|
+
# family_name_first :boolean default(TRUE)
|
41
|
+
# screenshot_generator :string
|
42
|
+
# pub_year_facet_range_interval :integer default(10)
|
43
|
+
# user_id :integer
|
44
|
+
# csv_charset_conversion :boolean default(FALSE), not null
|
45
|
+
# header_logo_file_name :string
|
46
|
+
# header_logo_content_type :string
|
47
|
+
# header_logo_file_size :integer
|
48
|
+
# header_logo_updated_at :datetime
|
49
|
+
# header_logo_meta :text
|
36
50
|
#
|
@@ -0,0 +1,24 @@
|
|
1
|
+
one:
|
2
|
+
id: 1
|
3
|
+
name: custom_1
|
4
|
+
display_name: "カスタム項目1"
|
5
|
+
position: 1
|
6
|
+
|
7
|
+
two:
|
8
|
+
id: 2
|
9
|
+
name: custom_2
|
10
|
+
display_name: "カスタム項目1"
|
11
|
+
position: 2
|
12
|
+
|
13
|
+
# == Schema Information
|
14
|
+
#
|
15
|
+
# Table name: manifestation_custom_properties
|
16
|
+
#
|
17
|
+
# id :integer not null, primary key
|
18
|
+
# name :string not null
|
19
|
+
# display_name :text not null
|
20
|
+
# note :text
|
21
|
+
# position :integer default(1), not null
|
22
|
+
# created_at :datetime not null
|
23
|
+
# updated_at :datetime not null
|
24
|
+
#
|
@@ -47,9 +47,7 @@ picture_file_00004:
|
|
47
47
|
# id :integer not null, primary key
|
48
48
|
# picture_attachable_id :integer
|
49
49
|
# picture_attachable_type :string
|
50
|
-
# content_type :string
|
51
50
|
# title :text
|
52
|
-
# thumbnail :string
|
53
51
|
# position :integer
|
54
52
|
# created_at :datetime
|
55
53
|
# updated_at :datetime
|
data/spec/fixtures/produces.yml
CHANGED
@@ -3,6 +3,7 @@ produce_00001:
|
|
3
3
|
updated_at: 2008-01-11 23:28:19.277110 +09:00
|
4
4
|
manifestation_id: 1
|
5
5
|
agent_id: 1
|
6
|
+
produce_type_id: 1
|
6
7
|
id: 1
|
7
8
|
position: 1
|
8
9
|
created_at: 2008-01-11 23:28:19.277110 +09:00
|
@@ -10,6 +11,7 @@ produce_00002:
|
|
10
11
|
updated_at: 2008-01-11 23:28:57.068191 +09:00
|
11
12
|
manifestation_id: 2
|
12
13
|
agent_id: 2
|
14
|
+
produce_type_id: 1
|
13
15
|
id: 2
|
14
16
|
position: 1
|
15
17
|
created_at: 2008-01-11 23:28:57.068191 +09:00
|
data/spec/fixtures/realizes.yml
CHANGED
@@ -3,6 +3,7 @@ realize_00001:
|
|
3
3
|
updated_at: 2008-01-11 23:28:19.277110 +09:00
|
4
4
|
expression_id: 1
|
5
5
|
agent_id: 1
|
6
|
+
realize_type_id: 1
|
6
7
|
id: 1
|
7
8
|
position: 1
|
8
9
|
created_at: 2008-01-11 23:28:19.277110 +09:00
|
@@ -10,6 +11,7 @@ realize_00002:
|
|
10
11
|
updated_at: 2008-01-11 23:28:57.068191 +09:00
|
11
12
|
expression_id: 2
|
12
13
|
agent_id: 2
|
14
|
+
realize_type_id: 1
|
13
15
|
id: 2
|
14
16
|
position: 2
|
15
17
|
created_at: 2008-01-11 23:28:57.068191 +09:00
|
@@ -5,14 +5,14 @@ one:
|
|
5
5
|
resource_import_file_id: 1
|
6
6
|
manifestation_id: 1
|
7
7
|
item_id: 1
|
8
|
-
body:
|
8
|
+
body: "original_title\tmanifestation_id"
|
9
9
|
|
10
10
|
two:
|
11
11
|
id: 2
|
12
12
|
resource_import_file_id: 1
|
13
13
|
manifestation_id: 1
|
14
14
|
item_id: 1
|
15
|
-
body: MyText
|
15
|
+
body: "MyText\t10"
|
16
16
|
|
17
17
|
# == Schema Information
|
18
18
|
#
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe ItemCustomProperty, type: :model do
|
4
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
5
|
+
end
|
6
|
+
|
7
|
+
# == Schema Information
|
8
|
+
#
|
9
|
+
# Table name: item_custom_properties
|
10
|
+
#
|
11
|
+
# id :integer not null, primary key
|
12
|
+
# name :string not null
|
13
|
+
# display_name :text not null
|
14
|
+
# note :text
|
15
|
+
# position :integer default(1), not null
|
16
|
+
# created_at :datetime not null
|
17
|
+
# updated_at :datetime not null
|
18
|
+
#
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe ItemCustomValue, type: :model do
|
4
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
5
|
+
end
|
6
|
+
|
7
|
+
# == Schema Information
|
8
|
+
#
|
9
|
+
# Table name: item_custom_values
|
10
|
+
#
|
11
|
+
# id :integer not null, primary key
|
12
|
+
# item_custom_property_id :integer not null
|
13
|
+
# item_id :integer not null
|
14
|
+
# value :text
|
15
|
+
# created_at :datetime not null
|
16
|
+
# updated_at :datetime not null
|
17
|
+
#
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe ManifestationCustomProperty, type: :model do
|
4
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
5
|
+
end
|
6
|
+
|
7
|
+
# == Schema Information
|
8
|
+
#
|
9
|
+
# Table name: manifestation_custom_properties
|
10
|
+
#
|
11
|
+
# id :integer not null, primary key
|
12
|
+
# name :string not null
|
13
|
+
# display_name :text not null
|
14
|
+
# note :text
|
15
|
+
# position :integer default(1), not null
|
16
|
+
# created_at :datetime not null
|
17
|
+
# updated_at :datetime not null
|
18
|
+
#
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe ManifestationCustomValue, type: :model do
|
4
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
5
|
+
end
|
6
|
+
|
7
|
+
# == Schema Information
|
8
|
+
#
|
9
|
+
# Table name: manifestation_custom_values
|
10
|
+
#
|
11
|
+
# id :integer not null, primary key
|
12
|
+
# manifestation_custom_property_id :integer not null
|
13
|
+
# manifestation_id :integer not null
|
14
|
+
# value :text
|
15
|
+
# created_at :datetime not null
|
16
|
+
# updated_at :datetime not null
|
17
|
+
#
|
@@ -261,7 +261,7 @@ describe Manifestation, solr: true do
|
|
261
261
|
lines = Manifestation.export()
|
262
262
|
csv = CSV.parse(lines, headers: true, col_sep: "\t")
|
263
263
|
m = csv.find{|row| row["manifestation_id"].to_i == manifestation.id }
|
264
|
-
expect(m["isbn"]).to eq "9784043898039//9784840239219"
|
264
|
+
expect(m["identifier:isbn"]).to eq "9784043898039//9784840239219"
|
265
265
|
end
|
266
266
|
|
267
267
|
it "should respect the role of the user" do
|
@@ -293,29 +293,19 @@ describe Manifestation, solr: true do
|
|
293
293
|
expect(m["item_note"]).to eq "test\ntest"
|
294
294
|
end
|
295
295
|
|
296
|
-
it 'should export custom properties
|
296
|
+
it 'should export custom properties"' do
|
297
297
|
item = FactoryBot.create(:item)
|
298
|
-
item.
|
299
|
-
|
300
|
-
item.custom_properties << FactoryBot.build(:custom_property, label: 'テスト項目2', value: 'test')
|
301
|
-
end
|
302
|
-
|
298
|
+
item.item_custom_values << FactoryBot.build(:item_custom_value)
|
299
|
+
item.manifestation.manifestation_custom_values << FactoryBot.build(:manifestation_custom_value)
|
303
300
|
lines = Manifestation.export(role: 'Librarian')
|
304
301
|
csv = CSV.parse(lines, headers: true, col_sep: "\t")
|
305
|
-
m = csv.find{|row| row["manifestation_id"].to_i == item.
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
item.manifestation.custom_properties << FactoryBot.build(:custom_property, label: 'テスト項目1', value: 'テスト')
|
313
|
-
item.custom_properties << FactoryBot.build(:custom_property, label: 'テスト項目2', value: 'test')
|
314
|
-
|
315
|
-
lines = Manifestation.export(role: 'User')
|
316
|
-
csv = CSV.parse(lines, headers: true, col_sep: "\t")
|
317
|
-
expect(csv['manifestation_custom_property_1'].compact).to be_empty
|
318
|
-
expect(csv['item_custom_property_2'].compact).to be_empty
|
302
|
+
m = csv.find{|row| row["manifestation_id"].to_i == item.manifestation.id }
|
303
|
+
item.item_custom_values.each do |custom_value|
|
304
|
+
expect(m["item:#{custom_value.item_custom_property.name}"]).to eq custom_value.value
|
305
|
+
end
|
306
|
+
item.manifestation.manifestation_custom_values.each do |custom_value|
|
307
|
+
expect(m["manifestation:#{custom_value.manifestation_custom_property.name}"]).to eq custom_value.value
|
308
|
+
end
|
319
309
|
end
|
320
310
|
end
|
321
311
|
end
|