enju_biblio 0.3.9 → 0.3.10.rc.1

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.
Files changed (85) 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 +64 -0
  4. data/app/controllers/items_controller.rb +3 -0
  5. data/app/controllers/manifestation_custom_properties_controller.rb +64 -0
  6. data/app/controllers/manifestations_controller.rb +8 -5
  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 +8 -1
  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 +18 -0
  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/resource_import_file.rb +81 -9
  23. data/app/policies/item_custom_property_policy.rb +21 -0
  24. data/app/policies/manifestation_custom_property_policy.rb +21 -0
  25. data/app/views/item_custom_properties/_form.html.erb +32 -0
  26. data/app/views/item_custom_properties/edit.html.erb +6 -0
  27. data/app/views/item_custom_properties/index.html.erb +36 -0
  28. data/app/views/item_custom_properties/new.html.erb +5 -0
  29. data/app/views/item_custom_properties/show.html.erb +21 -0
  30. data/app/views/items/_form.html.erb +13 -0
  31. data/app/views/items/show.html.erb +6 -0
  32. data/app/views/manifestation_custom_properties/_form.html.erb +32 -0
  33. data/app/views/manifestation_custom_properties/edit.html.erb +6 -0
  34. data/app/views/manifestation_custom_properties/index.html.erb +36 -0
  35. data/app/views/manifestation_custom_properties/new.html.erb +5 -0
  36. data/app/views/manifestation_custom_properties/show.html.erb +21 -0
  37. data/app/views/manifestations/_form.html.erb +13 -0
  38. data/app/views/manifestations/_show_detail_librarian.html.erb +8 -0
  39. data/app/views/picture_files/edit.html.erb +4 -0
  40. data/config/locales/translation_en.yml +20 -8
  41. data/config/locales/translation_ja.yml +20 -8
  42. data/config/routes.rb +2 -0
  43. data/db/migrate/20200425072340_create_manifestation_custom_properties.rb +12 -0
  44. data/db/migrate/20200425072349_create_item_custom_properties.rb +12 -0
  45. data/db/migrate/20200425074758_create_manifestation_custom_values.rb +12 -0
  46. data/db/migrate/20200425074822_create_item_custom_values.rb +12 -0
  47. data/lib/enju_biblio/version.rb +1 -1
  48. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_import_custom_values.yml +121 -0
  49. data/spec/cassette_library/resource_import_results/index_txt_ruby/renders_a_list_of_resource_import_results.yml +121 -0
  50. data/spec/controllers/content_types_controller_spec.rb +1 -1
  51. data/spec/controllers/items_controller_spec.rb +22 -0
  52. data/spec/controllers/manifestations_controller_spec.rb +22 -0
  53. data/spec/dummy/db/schema.rb +43 -21
  54. data/spec/factories/item_custom_property.rb +6 -0
  55. data/spec/factories/item_custom_value.rb +6 -0
  56. data/spec/factories/manifestation_custom_property.rb +6 -0
  57. data/spec/factories/manifestation_custom_value.rb +6 -0
  58. data/spec/fixtures/item_custom_properties.yml +24 -0
  59. data/spec/fixtures/library_groups.yml +0 -2
  60. data/spec/fixtures/manifestation_custom_properties.yml +24 -0
  61. data/spec/models/item_custom_property_spec.rb +18 -0
  62. data/spec/models/item_custom_value_spec.rb +17 -0
  63. data/spec/models/manifestation_custom_property_spec.rb +18 -0
  64. data/spec/models/manifestation_custom_value_spec.rb +17 -0
  65. data/spec/models/manifestation_spec.rb +15 -0
  66. data/spec/models/resource_import_file_spec.rb +38 -12
  67. data/spec/requests/item_custom_properties_spec.rb +129 -0
  68. data/spec/requests/manifestation_custom_properties_spec.rb +129 -0
  69. data/spec/routing/item_custom_properties_routing_spec.rb +38 -0
  70. data/spec/routing/manifestation_custom_properties_routing_spec.rb +38 -0
  71. data/spec/system/items_spec.rb +12 -0
  72. data/spec/system/manifestations_spec.rb +12 -0
  73. data/spec/views/item_custom_properties/edit.html.erb_spec.rb +21 -0
  74. data/spec/views/item_custom_properties/index.html.erb_spec.rb +24 -0
  75. data/spec/views/item_custom_properties/new.html.erb_spec.rb +21 -0
  76. data/spec/views/item_custom_properties/show.html.erb_spec.rb +16 -0
  77. data/spec/views/manifestation_custom_properties/edit.html.erb_spec.rb +21 -0
  78. data/spec/views/manifestation_custom_properties/index.html.erb_spec.rb +24 -0
  79. data/spec/views/manifestation_custom_properties/new.html.erb_spec.rb +21 -0
  80. data/spec/views/manifestation_custom_properties/show.html.erb_spec.rb +16 -0
  81. data/spec/views/resource_import_results/index.txt.ruby_spec.rb +4 -4
  82. metadata +569 -497
  83. data/db/migrate/20200322053443_add_default_custom_label_to_library_group.rb +0 -6
  84. data/db/migrate/20200322083313_create_custom_labels.rb +0 -10
  85. data/db/migrate/20200322083458_create_custom_properties.rb +0 -12
@@ -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
@@ -24,6 +24,12 @@ RSpec.describe 'Manifestations', type: :system do
24
24
  visit manifestation_path(@item.manifestation.id, locale: :ja)
25
25
  expect(page).to have_content @item.manifestation.memo
26
26
  end
27
+
28
+ it 'should show custom properties' do
29
+ @item.manifestation.manifestation_custom_values << FactoryBot.build(:manifestation_custom_value)
30
+ visit manifestation_path(@item.manifestation.id, locale: :ja)
31
+ expect(page).to have_content @item.manifestation.manifestation_custom_values.first.value
32
+ end
27
33
  end
28
34
 
29
35
  describe 'When logged in as User' do
@@ -41,6 +47,12 @@ RSpec.describe 'Manifestations', type: :system do
41
47
  visit manifestation_path(@item.manifestation.id, locale: :ja)
42
48
  expect(page).not_to have_content @item.manifestation.memo
43
49
  end
50
+
51
+ it 'should not show custom properties' do
52
+ @item.manifestation.manifestation_custom_values << FactoryBot.build(:manifestation_custom_value)
53
+ visit manifestation_path(@item.manifestation.id, locale: :ja)
54
+ expect(page).not_to have_content @item.manifestation.manifestation_custom_values.first.value
55
+ end
44
56
  end
45
57
 
46
58
  describe 'When not logged in' do
@@ -0,0 +1,21 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "item_custom_properties/edit", type: :view do
4
+ before(:each) do
5
+ @item_custom_property = assign(:item_custom_property, ItemCustomProperty.create!(
6
+ name: "my_string",
7
+ note: "MyText"
8
+ ))
9
+ end
10
+
11
+ it "renders the edit item_custom_property form" do
12
+ render
13
+
14
+ assert_select "form[action=?][method=?]", item_custom_property_path(@item_custom_property), "post" do
15
+
16
+ assert_select "input[name=?]", "item_custom_property[name]"
17
+
18
+ assert_select "textarea[name=?]", "item_custom_property[note]"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,24 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "item_custom_properties/index", type: :view do
4
+ before(:each) do
5
+ assign(:item_custom_properties, [
6
+ ItemCustomProperty.create!(
7
+ name: "name1",
8
+ display_name: "カスタム項目1",
9
+ note: "MyText"
10
+ ),
11
+ ItemCustomProperty.create!(
12
+ name: "name2",
13
+ display_name: "カスタム項目2",
14
+ note: "MyText"
15
+ )
16
+ ])
17
+ end
18
+
19
+ it "renders a list of item_custom_properties" do
20
+ render
21
+ assert_select "tr>td", text: "name1".to_s, count: 1
22
+ assert_select "tr>td", text: "MyText".to_s, count: 2
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "item_custom_properties/new", type: :view do
4
+ before(:each) do
5
+ assign(:item_custom_property, ItemCustomProperty.new(
6
+ name: "my_string",
7
+ note: "MyText"
8
+ ))
9
+ end
10
+
11
+ it "renders new item_custom_property form" do
12
+ render
13
+
14
+ assert_select "form[action=?][method=?]", item_custom_properties_path, "post" do
15
+
16
+ assert_select "input[name=?]", "item_custom_property[name]"
17
+
18
+ assert_select "textarea[name=?]", "item_custom_property[note]"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,16 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "item_custom_properties/show", type: :view do
4
+ before(:each) do
5
+ @item_custom_property = assign(:item_custom_property, ItemCustomProperty.create!(
6
+ name: "name",
7
+ note: "MyText"
8
+ ))
9
+ end
10
+
11
+ it "renders attributes in <p>" do
12
+ render
13
+ expect(rendered).to match(/name/)
14
+ expect(rendered).to match(/MyText/)
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "manifestation_custom_properties/edit", type: :view do
4
+ before(:each) do
5
+ @manifestation_custom_property = assign(:manifestation_custom_property, ManifestationCustomProperty.create!(
6
+ name: "my_string",
7
+ note: "MyText"
8
+ ))
9
+ end
10
+
11
+ it "renders the edit manifestation_custom_property form" do
12
+ render
13
+
14
+ assert_select "form[action=?][method=?]", manifestation_custom_property_path(@manifestation_custom_property), "post" do
15
+
16
+ assert_select "input[name=?]", "manifestation_custom_property[name]"
17
+
18
+ assert_select "textarea[name=?]", "manifestation_custom_property[note]"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,24 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "manifestation_custom_properties/index", type: :view do
4
+ before(:each) do
5
+ assign(:manifestation_custom_properties, [
6
+ ManifestationCustomProperty.create!(
7
+ name: "name1",
8
+ display_name: "カスタム項目1",
9
+ note: "MyText"
10
+ ),
11
+ ManifestationCustomProperty.create!(
12
+ name: "name2",
13
+ display_name: "カスタム項目2",
14
+ note: "MyText"
15
+ )
16
+ ])
17
+ end
18
+
19
+ it "renders a list of manifestation_custom_properties" do
20
+ render
21
+ assert_select "tr>td", text: "name1".to_s, count: 1
22
+ assert_select "tr>td", text: "MyText".to_s, count: 2
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "manifestation_custom_properties/new", type: :view do
4
+ before(:each) do
5
+ assign(:manifestation_custom_property, ManifestationCustomProperty.new(
6
+ name: "my_string",
7
+ note: "MyText"
8
+ ))
9
+ end
10
+
11
+ it "renders new manifestation_custom_property form" do
12
+ render
13
+
14
+ assert_select "form[action=?][method=?]", manifestation_custom_properties_path, "post" do
15
+
16
+ assert_select "input[name=?]", "manifestation_custom_property[name]"
17
+
18
+ assert_select "textarea[name=?]", "manifestation_custom_property[note]"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,16 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "manifestation_custom_properties/show", type: :view do
4
+ before(:each) do
5
+ @manifestation_custom_property = assign(:manifestation_custom_property, ManifestationCustomProperty.create!(
6
+ name: "name",
7
+ note: "MyText"
8
+ ))
9
+ end
10
+
11
+ it "renders attributes in <p>" do
12
+ render
13
+ expect(rendered).to match(/name/)
14
+ expect(rendered).to match(/MyText/)
15
+ end
16
+ end
@@ -10,13 +10,13 @@ describe "resource_import_results/index.txt.ruby" do
10
10
  user: users(:admin)
11
11
  )
12
12
  file.import_start
13
- assign(:resource_import_file_id, file.id)
14
- assign(:resource_import_results, ResourceImportFile.find(file.id).resource_import_results)
13
+ assign(:resource_import_file, file)
14
+ assign(:resource_import_results, file.resource_import_results)
15
15
  end
16
16
 
17
- it "renders a list of resource_import_results" do
17
+ it "renders a list of resource_import_results", vcr: true do
18
18
  render
19
19
  expect(CSV.parse(rendered, headers: true, col_sep: "\t").first['original_title']).to eq 'タイトル'
20
- expect(CSV.parse(rendered, headers: true, col_sep: "\t")[10]['original_title']).to eq 'test8'
20
+ expect(CSV.parse(rendered, headers: true, col_sep: "\t")[12]['imported_manifestation_id']).to be_present
21
21
  end
22
22
  end