enju_biblio 0.3.9 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/content_types_controller.rb +1 -1
  3. data/app/controllers/item_custom_properties_controller.rb +69 -0
  4. data/app/controllers/items_controller.rb +3 -0
  5. data/app/controllers/manifestation_custom_properties_controller.rb +69 -0
  6. data/app/controllers/manifestations_controller.rb +9 -6
  7. data/app/controllers/resource_import_results_controller.rb +6 -2
  8. data/app/models/agent_type.rb +0 -1
  9. data/app/models/carrier_type.rb +0 -1
  10. data/app/models/content_type.rb +0 -1
  11. data/app/models/form_of_work.rb +1 -2
  12. data/app/models/frequency.rb +0 -1
  13. data/app/models/identifier_type.rb +0 -1
  14. data/app/models/item.rb +17 -6
  15. data/app/models/item_custom_property.rb +18 -0
  16. data/app/models/item_custom_value.rb +17 -0
  17. data/app/models/license.rb +0 -1
  18. data/app/models/manifestation.rb +55 -11
  19. data/app/models/manifestation_custom_property.rb +18 -0
  20. data/app/models/manifestation_custom_value.rb +17 -0
  21. data/app/models/medium_of_performance.rb +1 -2
  22. data/app/models/picture_file.rb +0 -2
  23. data/app/models/resource_export_file.rb +4 -2
  24. data/app/models/resource_import_file.rb +151 -61
  25. data/app/policies/item_custom_property_policy.rb +21 -0
  26. data/app/policies/manifestation_custom_property_policy.rb +21 -0
  27. data/app/views/item_custom_properties/_form.html.erb +32 -0
  28. data/app/views/item_custom_properties/edit.html.erb +13 -0
  29. data/app/views/item_custom_properties/index.html.erb +43 -0
  30. data/app/views/item_custom_properties/new.html.erb +12 -0
  31. data/app/views/item_custom_properties/show.html.erb +28 -0
  32. data/app/views/items/_form.html.erb +13 -0
  33. data/app/views/items/show.html.erb +6 -0
  34. data/app/views/manifestation_custom_properties/_form.html.erb +32 -0
  35. data/app/views/manifestation_custom_properties/edit.html.erb +13 -0
  36. data/app/views/manifestation_custom_properties/index.html.erb +43 -0
  37. data/app/views/manifestation_custom_properties/new.html.erb +12 -0
  38. data/app/views/manifestation_custom_properties/show.html.erb +28 -0
  39. data/app/views/manifestations/_export_detail.html.erb +1 -0
  40. data/app/views/manifestations/_export_list.html.erb +1 -0
  41. data/app/views/manifestations/_form.html.erb +18 -0
  42. data/app/views/manifestations/_show_detail_librarian.html.erb +14 -0
  43. data/app/views/manifestations/_show_detail_user.html.erb +8 -0
  44. data/app/views/manifestations/show.json.jbuilder +2 -0
  45. data/app/views/picture_files/edit.html.erb +4 -0
  46. data/config/locales/translation_en.yml +22 -8
  47. data/config/locales/translation_ja.yml +22 -8
  48. data/config/routes.rb +2 -0
  49. data/db/migrate/20081027150907_create_picture_files.rb +0 -2
  50. data/db/migrate/20200425072340_create_manifestation_custom_properties.rb +12 -0
  51. data/db/migrate/20200425072349_create_item_custom_properties.rb +12 -0
  52. data/db/migrate/20200425074758_create_manifestation_custom_values.rb +12 -0
  53. data/db/migrate/20200425074822_create_item_custom_values.rb +12 -0
  54. data/lib/enju_biblio/openurl.rb +5 -1
  55. data/lib/enju_biblio/sru.rb +2 -0
  56. data/lib/enju_biblio/version.rb +1 -1
  57. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_import_custom_values.yml +121 -0
  58. data/spec/cassette_library/resource_import_results/index_txt_ruby/renders_a_list_of_resource_import_results.yml +121 -0
  59. data/spec/controllers/content_types_controller_spec.rb +1 -1
  60. data/spec/controllers/item_custom_properties_controller_spec.rb +449 -0
  61. data/spec/controllers/items_controller_spec.rb +22 -0
  62. data/spec/controllers/manifestation_custom_properties_controller_spec.rb +449 -0
  63. data/spec/controllers/manifestations_controller_spec.rb +22 -0
  64. data/spec/dummy/db/schema.rb +43 -23
  65. data/spec/factories/item_custom_property.rb +6 -0
  66. data/spec/factories/item_custom_value.rb +6 -0
  67. data/spec/factories/manifestation_custom_property.rb +6 -0
  68. data/spec/factories/manifestation_custom_value.rb +6 -0
  69. data/spec/fixtures/creates.yml +2 -0
  70. data/spec/fixtures/item_custom_properties.yml +24 -0
  71. data/spec/fixtures/library_groups.yml +0 -2
  72. data/spec/fixtures/manifestation_custom_properties.yml +24 -0
  73. data/spec/fixtures/picture_files.yml +0 -2
  74. data/spec/fixtures/produces.yml +2 -0
  75. data/spec/fixtures/realizes.yml +2 -0
  76. data/spec/models/item_custom_property_spec.rb +18 -0
  77. data/spec/models/item_custom_value_spec.rb +17 -0
  78. data/spec/models/manifestation_custom_property_spec.rb +18 -0
  79. data/spec/models/manifestation_custom_value_spec.rb +17 -0
  80. data/spec/models/manifestation_spec.rb +16 -1
  81. data/spec/models/picture_file_spec.rb +0 -2
  82. data/spec/models/resource_export_file_spec.rb +61 -8
  83. data/spec/models/resource_import_file_spec.rb +43 -13
  84. data/spec/requests/item_custom_properties_spec.rb +129 -0
  85. data/spec/requests/manifestation_custom_properties_spec.rb +129 -0
  86. data/spec/routing/item_custom_properties_routing_spec.rb +38 -0
  87. data/spec/routing/manifestation_custom_properties_routing_spec.rb +38 -0
  88. data/spec/system/items_spec.rb +12 -0
  89. data/spec/system/manifestations_spec.rb +12 -0
  90. data/spec/views/item_custom_properties/edit.html.erb_spec.rb +21 -0
  91. data/spec/views/item_custom_properties/index.html.erb_spec.rb +25 -0
  92. data/spec/views/item_custom_properties/new.html.erb_spec.rb +21 -0
  93. data/spec/views/item_custom_properties/show.html.erb_spec.rb +16 -0
  94. data/spec/views/manifestation_custom_properties/edit.html.erb_spec.rb +21 -0
  95. data/spec/views/manifestation_custom_properties/index.html.erb_spec.rb +25 -0
  96. data/spec/views/manifestation_custom_properties/new.html.erb_spec.rb +21 -0
  97. data/spec/views/manifestation_custom_properties/show.html.erb_spec.rb +16 -0
  98. data/spec/views/manifestations/show.json.jbuilder_spec.rb +16 -0
  99. data/spec/views/resource_import_results/index.txt.ruby_spec.rb +4 -4
  100. metadata +560 -481
  101. data/db/migrate/20200322053443_add_default_custom_label_to_library_group.rb +0 -6
  102. data/db/migrate/20200322083313_create_custom_labels.rb +0 -10
  103. data/db/migrate/20200322083458_create_custom_properties.rb +0 -12
@@ -9,7 +9,8 @@ describe ResourceImportFile do
9
9
  @file = ResourceImportFile.create(
10
10
  resource_import: File.new("#{Rails.root}/../../examples/resource_import_file_sample1.tsv"),
11
11
  default_shelf_id: 3,
12
- user: users(:admin)
12
+ user: users(:admin),
13
+ edit_mode: 'create'
13
14
  )
14
15
  end
15
16
 
@@ -29,7 +30,7 @@ describe ResourceImportFile do
29
30
  Manifestation.count.should eq old_manifestations_count + 10
30
31
  Item.count.should eq old_items_count + 10
31
32
  Agent.count.should eq old_agents_count + 9
32
- @file.resource_import_results.order(:id).first.body.split("\t").first.should eq 'manifestation_identifier'
33
+ @file.resource_import_results.order(:id).first.body.split("\t").first.should eq 'imported_manifestation_id'
33
34
  ResourceImportResult.count.should eq old_import_results_count + 23
34
35
 
35
36
  manifestation_101 = Manifestation.find_by(manifestation_identifier: '101')
@@ -156,6 +157,16 @@ describe ResourceImportFile do
156
157
  expect(manifestation.identifier_contents(:isbn)).to include("9784840239219")
157
158
  expect(manifestation.identifier_contents(:isbn)).to include("9784043898039")
158
159
  end
160
+
161
+ it "should import custom values", vcr: true do
162
+ @file.import_start
163
+ item_10102 = Item.find_by(item_identifier: '10102')
164
+ expect(item_10102.manifestation.manifestation_custom_values.pluck(:value)).to eq ['カスタム項目テスト1', 'カスタム項目テスト2']
165
+ expect(item_10102.item_custom_values.pluck(:value)).to eq []
166
+ item_10103 = Item.find_by(item_identifier: '10103')
167
+ expect(item_10103.manifestation.manifestation_custom_values.pluck(:value)).to eq ["カスタム項目テスト1", "カスタム項目テスト2"]
168
+ expect(item_10103.item_custom_values.pluck(:value)).to eq ['カスタム項目テスト3', 'カスタム項目テスト4']
169
+ end
159
170
  end
160
171
 
161
172
  describe "ISBN import" do
@@ -216,15 +227,15 @@ describe ResourceImportFile do
216
227
  old_items_count = Item.count
217
228
  old_agents_count = Agent.count
218
229
  old_import_results_count = ResourceImportResult.count
219
- @file.import_start.should eq({manifestation_imported: 9, item_imported: 8, manifestation_found: 5, item_found: 3, failed: 7})
230
+ @file.import_start.should eq({manifestation_imported: 10, item_imported: 10, manifestation_found: 6, item_found: 3, failed: 7})
220
231
  manifestation = Item.find_by(item_identifier: '11111').manifestation
221
232
  manifestation.publishers.first.full_name.should eq 'test4'
222
233
  manifestation.publishers.first.full_name_transcription.should eq 'てすと4'
223
234
  manifestation.publishers.second.full_name_transcription.should eq 'てすと5'
224
- Manifestation.count.should eq old_manifestations_count + 9
225
- Item.count.should eq old_items_count + 8
235
+ Manifestation.count.should eq old_manifestations_count + 10
236
+ Item.count.should eq old_items_count + 10
226
237
  Agent.count.should eq old_agents_count + 9
227
- ResourceImportResult.count.should eq old_import_results_count + 21
238
+ ResourceImportResult.count.should eq old_import_results_count + 23
228
239
  Item.find_by(item_identifier: '10101').manifestation.creators.size.should eq 2
229
240
  Item.find_by(item_identifier: '10101').manifestation.date_of_publication.should eq Time.zone.parse('2001-01-01')
230
241
  Item.find_by(item_identifier: '10102').manifestation.date_of_publication.should eq Time.zone.parse('2001-01-01')
@@ -335,20 +346,28 @@ resource_import_file_test_description test\\ntest test\\ntest test_description t
335
346
  expect(manifestation.items.first.note).to eq "test\ntest"
336
347
  end
337
348
  end
349
+
350
+ describe "when it contains custom properties" do
351
+ xit "should be imported" do
352
+ end
353
+ end
338
354
  end
339
355
 
340
356
  describe "when its mode is 'update'" do
341
- it "should update items", vcr: true do
342
- file = ResourceImportFile.create!(
357
+ before(:each) do
358
+ @file = ResourceImportFile.create!(
343
359
  resource_import: File.new("#{Rails.root}/../../examples/item_update_file.tsv"),
344
360
  user: users(:admin),
345
361
  edit_mode: 'update'
346
362
  )
347
- file.modify
348
- expect(file.resource_import_results.first).to be_truthy
349
- expect(file.resource_import_results.first.body).to match /item_identifier/
363
+ end
364
+
365
+ it "should update items", vcr: true do
366
+ @file.modify
367
+ expect(@file.resource_import_results.first).to be_truthy
368
+ expect(@file.resource_import_results.first.body).to match /item_identifier/
350
369
  item_00001 = Item.find_by(item_identifier: '00001')
351
- item_00001.manifestation.creators.order('agents.id').collect(&:full_name).should eq ['たなべ', 'こうすけ']
370
+ item_00001.manifestation.creators.order('agents.id').pluck(:full_name).should eq ['たなべ', 'こうすけ']
352
371
  item_00001.binding_item_identifier.should eq '900001'
353
372
  item_00001.binding_call_number.should eq '336|A'
354
373
  item_00001.binded_at.should eq Time.zone.parse('2014-08-16')
@@ -361,7 +380,18 @@ resource_import_file_test_description test\\ntest test\\ntest test_description t
361
380
  item_00003.include_supplements.should be_truthy
362
381
 
363
382
  Item.find_by(item_identifier: '00004').include_supplements.should be_falsy
364
- Item.find_by(item_identifier: '00025').call_number.should eq "547|ヤ"
383
+
384
+ item_00025 = Item.find_by(item_identifier: '00025')
385
+ expect(item_00025.manifestation.original_title).to eq "テスト4"
386
+ expect(item_00025.manifestation.subjects.pluck(:term)).to eq ['test2', 'test3']
387
+ expect(item_00025.call_number).to eq "547|ヤ"
388
+ end
389
+
390
+ it "should update custom values", vcr: true do
391
+ @file.import_start
392
+ item_00001 = Item.find_by(item_identifier: '00001')
393
+ expect(item_00001.manifestation.manifestation_custom_values.pluck(:manifestation_custom_property_id, :value)).to eq [[2, "カスタム項目5"]]
394
+ expect(item_00001.item_custom_values.order(:item_custom_property_id).first.value).to eq "カスタム項目6"
365
395
  end
366
396
 
367
397
  # it "should update series_statement", vcr: true do
@@ -0,0 +1,129 @@
1
+ require 'rails_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to test the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+
15
+ RSpec.describe "/item_custom_properties", type: :request do
16
+ # ItemCustomProperty. As you add validations to ItemCustomProperty, be sure to
17
+ # adjust the attributes here as well.
18
+ let(:valid_attributes) {
19
+ skip("Add a hash of attributes valid for your model")
20
+ }
21
+
22
+ let(:invalid_attributes) {
23
+ skip("Add a hash of attributes invalid for your model")
24
+ }
25
+
26
+ describe "GET /index" do
27
+ it "renders a successful response" do
28
+ ItemCustomProperty.create! valid_attributes
29
+ get item_custom_properties_url
30
+ response.status.should redirect_to(new_user_session_url)
31
+ end
32
+ end
33
+
34
+ describe "GET /show" do
35
+ it "renders a successful response" do
36
+ item_custom_property = ItemCustomProperty.create! valid_attributes
37
+ get item_custom_property_url(item_custom_property)
38
+ expect(response).to redirect_to(new_user_session_url)
39
+ end
40
+ end
41
+
42
+ describe "GET /new" do
43
+ it "renders a successful response" do
44
+ get new_item_custom_property_url
45
+ expect(response).to redirect_to(new_user_session_url)
46
+ end
47
+ end
48
+
49
+ describe "GET /edit" do
50
+ it "render a successful response" do
51
+ item_custom_property = ItemCustomProperty.create! valid_attributes
52
+ get edit_item_custom_property_url(item_custom_property)
53
+ expect(response).to redirect_to(new_user_session_url)
54
+ end
55
+ end
56
+
57
+ describe "POST /create" do
58
+ context "with valid parameters" do
59
+ it "creates a new ItemCustomProperty" do
60
+ expect {
61
+ post item_custom_properties_url, params: { item_custom_property: valid_attributes }
62
+ }.to change(ItemCustomProperty, :count).by(1)
63
+ end
64
+
65
+ it "redirects to the created item_custom_property" do
66
+ post item_custom_properties_url, params: { item_custom_property: valid_attributes }
67
+ expect(response).to redirect_to(item_custom_property_url(ItemCustomProperty.last))
68
+ end
69
+ end
70
+
71
+ context "with invalid parameters" do
72
+ it "does not create a new ItemCustomProperty" do
73
+ expect {
74
+ post item_custom_properties_url, params: { item_custom_property: invalid_attributes }
75
+ }.to change(ItemCustomProperty, :count).by(0)
76
+ end
77
+
78
+ it "renders a successful response (i.e. to display the 'new' template)" do
79
+ post item_custom_properties_url, params: { item_custom_property: invalid_attributes }
80
+ expect(response).to redirect_to(new_user_session_url)
81
+ end
82
+ end
83
+ end
84
+
85
+ describe "PATCH /update" do
86
+ context "with valid parameters" do
87
+ let(:new_attributes) {
88
+ skip("Add a hash of attributes valid for your model")
89
+ }
90
+
91
+ it "updates the requested item_custom_property" do
92
+ item_custom_property = ItemCustomProperty.create! valid_attributes
93
+ patch item_custom_property_url(item_custom_property), params: { item_custom_property: new_attributes }
94
+ item_custom_property.reload
95
+ skip("Add assertions for updated state")
96
+ end
97
+
98
+ it "redirects to the item_custom_property" do
99
+ item_custom_property = ItemCustomProperty.create! valid_attributes
100
+ patch item_custom_property_url(item_custom_property), params: { item_custom_property: new_attributes }
101
+ item_custom_property.reload
102
+ expect(response).to redirect_to(item_custom_property_url(item_custom_property))
103
+ end
104
+ end
105
+
106
+ context "with invalid parameters" do
107
+ it "renders a successful response (i.e. to display the 'edit' template)" do
108
+ item_custom_property = ItemCustomProperty.create! valid_attributes
109
+ patch item_custom_property_url(item_custom_property), params: { item_custom_property: invalid_attributes }
110
+ expect(response).to redirect_to(new_user_session_url)
111
+ end
112
+ end
113
+ end
114
+
115
+ describe "DELETE /destroy" do
116
+ it "destroys the requested item_custom_property" do
117
+ item_custom_property = ItemCustomProperty.create! valid_attributes
118
+ expect {
119
+ delete item_custom_property_url(item_custom_property)
120
+ }.to change(ItemCustomProperty, :count).by(-1)
121
+ end
122
+
123
+ it "redirects to the item_custom_properties list" do
124
+ item_custom_property = ItemCustomProperty.create! valid_attributes
125
+ delete item_custom_property_url(item_custom_property)
126
+ expect(response).to redirect_to(item_custom_properties_url)
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,129 @@
1
+ require 'rails_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to test the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+
15
+ RSpec.describe "/manifestation_custom_properties", type: :request do
16
+ # ManifestationCustomProperty. As you add validations to ManifestationCustomProperty, be sure to
17
+ # adjust the attributes here as well.
18
+ let(:valid_attributes) {
19
+ skip("Add a hash of attributes valid for your model")
20
+ }
21
+
22
+ let(:invalid_attributes) {
23
+ skip("Add a hash of attributes invalid for your model")
24
+ }
25
+
26
+ describe "GET /index" do
27
+ it "renders a successful response" do
28
+ ManifestationCustomProperty.create! valid_attributes
29
+ get manifestation_custom_properties_url
30
+ response.status.should redirect_to(new_user_session_url)
31
+ end
32
+ end
33
+
34
+ describe "GET /show" do
35
+ it "renders a successful response" do
36
+ manifestation_custom_property = ManifestationCustomProperty.create! valid_attributes
37
+ get manifestation_custom_property_url(manifestation_custom_property)
38
+ expect(response).to redirect_to(new_user_session_url)
39
+ end
40
+ end
41
+
42
+ describe "GET /new" do
43
+ it "renders a successful response" do
44
+ get new_manifestation_custom_property_url
45
+ expect(response).to redirect_to(new_user_session_url)
46
+ end
47
+ end
48
+
49
+ describe "GET /edit" do
50
+ it "render a successful response" do
51
+ manifestation_custom_property = ManifestationCustomProperty.create! valid_attributes
52
+ get edit_manifestation_custom_property_url(manifestation_custom_property)
53
+ expect(response).to redirect_to(new_user_session_url)
54
+ end
55
+ end
56
+
57
+ describe "POST /create" do
58
+ context "with valid parameters" do
59
+ it "creates a new ManifestationCustomProperty" do
60
+ expect {
61
+ post manifestation_custom_properties_url, params: { manifestation_custom_property: valid_attributes }
62
+ }.to change(ManifestationCustomProperty, :count).by(1)
63
+ end
64
+
65
+ it "redirects to the created manifestation_custom_property" do
66
+ post manifestation_custom_properties_url, params: { manifestation_custom_property: valid_attributes }
67
+ expect(response).to redirect_to(manifestation_custom_property_url(ManifestationCustomProperty.last))
68
+ end
69
+ end
70
+
71
+ context "with invalid parameters" do
72
+ it "does not create a new ManifestationCustomProperty" do
73
+ expect {
74
+ post manifestation_custom_properties_url, params: { manifestation_custom_property: invalid_attributes }
75
+ }.to change(ManifestationCustomProperty, :count).by(0)
76
+ end
77
+
78
+ it "renders a successful response (i.e. to display the 'new' template)" do
79
+ post manifestation_custom_properties_url, params: { manifestation_custom_property: invalid_attributes }
80
+ expect(response).to redirect_to(new_user_session_url)
81
+ end
82
+ end
83
+ end
84
+
85
+ describe "PATCH /update" do
86
+ context "with valid parameters" do
87
+ let(:new_attributes) {
88
+ skip("Add a hash of attributes valid for your model")
89
+ }
90
+
91
+ it "updates the requested manifestation_custom_property" do
92
+ manifestation_custom_property = ManifestationCustomProperty.create! valid_attributes
93
+ patch manifestation_custom_property_url(manifestation_custom_property), params: { manifestation_custom_property: new_attributes }
94
+ manifestation_custom_property.reload
95
+ skip("Add assertions for updated state")
96
+ end
97
+
98
+ it "redirects to the manifestation_custom_property" do
99
+ manifestation_custom_property = ManifestationCustomProperty.create! valid_attributes
100
+ patch manifestation_custom_property_url(manifestation_custom_property), params: { manifestation_custom_property: new_attributes }
101
+ manifestation_custom_property.reload
102
+ expect(response).to redirect_to(manifestation_custom_property_url(manifestation_custom_property))
103
+ end
104
+ end
105
+
106
+ context "with invalid parameters" do
107
+ it "renders a successful response (i.e. to display the 'edit' template)" do
108
+ manifestation_custom_property = ManifestationCustomProperty.create! valid_attributes
109
+ patch manifestation_custom_property_url(manifestation_custom_property), params: { manifestation_custom_property: invalid_attributes }
110
+ expect(response).to redirect_to(new_user_session_url)
111
+ end
112
+ end
113
+ end
114
+
115
+ describe "DELETE /destroy" do
116
+ it "destroys the requested manifestation_custom_property" do
117
+ manifestation_custom_property = ManifestationCustomProperty.create! valid_attributes
118
+ expect {
119
+ delete manifestation_custom_property_url(manifestation_custom_property)
120
+ }.to change(ManifestationCustomProperty, :count).by(-1)
121
+ end
122
+
123
+ it "redirects to the manifestation_custom_properties list" do
124
+ manifestation_custom_property = ManifestationCustomProperty.create! valid_attributes
125
+ delete manifestation_custom_property_url(manifestation_custom_property)
126
+ expect(response).to redirect_to(manifestation_custom_properties_url)
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,38 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.describe ItemCustomPropertiesController, type: :routing do
4
+ describe "routing" do
5
+ it "routes to #index" do
6
+ expect(get: "/item_custom_properties").to route_to("item_custom_properties#index")
7
+ end
8
+
9
+ it "routes to #new" do
10
+ expect(get: "/item_custom_properties/new").to route_to("item_custom_properties#new")
11
+ end
12
+
13
+ it "routes to #show" do
14
+ expect(get: "/item_custom_properties/1").to route_to("item_custom_properties#show", id: "1")
15
+ end
16
+
17
+ it "routes to #edit" do
18
+ expect(get: "/item_custom_properties/1/edit").to route_to("item_custom_properties#edit", id: "1")
19
+ end
20
+
21
+
22
+ it "routes to #create" do
23
+ expect(post: "/item_custom_properties").to route_to("item_custom_properties#create")
24
+ end
25
+
26
+ it "routes to #update via PUT" do
27
+ expect(put: "/item_custom_properties/1").to route_to("item_custom_properties#update", id: "1")
28
+ end
29
+
30
+ it "routes to #update via PATCH" do
31
+ expect(patch: "/item_custom_properties/1").to route_to("item_custom_properties#update", id: "1")
32
+ end
33
+
34
+ it "routes to #destroy" do
35
+ expect(delete: "/item_custom_properties/1").to route_to("item_custom_properties#destroy", id: "1")
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,38 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.describe ManifestationCustomPropertiesController, type: :routing do
4
+ describe "routing" do
5
+ it "routes to #index" do
6
+ expect(get: "/manifestation_custom_properties").to route_to("manifestation_custom_properties#index")
7
+ end
8
+
9
+ it "routes to #new" do
10
+ expect(get: "/manifestation_custom_properties/new").to route_to("manifestation_custom_properties#new")
11
+ end
12
+
13
+ it "routes to #show" do
14
+ expect(get: "/manifestation_custom_properties/1").to route_to("manifestation_custom_properties#show", id: "1")
15
+ end
16
+
17
+ it "routes to #edit" do
18
+ expect(get: "/manifestation_custom_properties/1/edit").to route_to("manifestation_custom_properties#edit", id: "1")
19
+ end
20
+
21
+
22
+ it "routes to #create" do
23
+ expect(post: "/manifestation_custom_properties").to route_to("manifestation_custom_properties#create")
24
+ end
25
+
26
+ it "routes to #update via PUT" do
27
+ expect(put: "/manifestation_custom_properties/1").to route_to("manifestation_custom_properties#update", id: "1")
28
+ end
29
+
30
+ it "routes to #update via PATCH" do
31
+ expect(patch: "/manifestation_custom_properties/1").to route_to("manifestation_custom_properties#update", id: "1")
32
+ end
33
+
34
+ it "routes to #destroy" do
35
+ expect(delete: "/manifestation_custom_properties/1").to route_to("manifestation_custom_properties#destroy", id: "1")
36
+ end
37
+ end
38
+ end
@@ -39,6 +39,12 @@ RSpec.describe 'Manifestations', type: :system do
39
39
  visit item_path(@item.id, locale: :ja)
40
40
  expect(page).to have_content bookstore.name
41
41
  end
42
+
43
+ it 'should show custom properties' do
44
+ @item.item_custom_values << FactoryBot.build(:item_custom_value)
45
+ visit item_path(@item.id, locale: :ja)
46
+ expect(page).to have_content @item.item_custom_values.first.value
47
+ end
42
48
  end
43
49
 
44
50
  describe 'When logged in as User' do
@@ -71,6 +77,12 @@ RSpec.describe 'Manifestations', type: :system do
71
77
  visit item_path(@item.id, locale: :ja)
72
78
  expect(page).not_to have_content bookstore.name
73
79
  end
80
+
81
+ it 'should not show custom properties' do
82
+ @item.item_custom_values << FactoryBot.build(:item_custom_value)
83
+ visit item_path(@item.id, locale: :ja)
84
+ expect(page).not_to have_content @item.item_custom_values.first.value
85
+ end
74
86
  end
75
87
 
76
88
  describe 'When not logged in' do