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
@@ -26,10 +26,10 @@ describe ResourceExportFile do
|
|
26
26
|
expect(columns).to include "item_price"
|
27
27
|
end
|
28
28
|
|
29
|
-
it "should export
|
29
|
+
it "should export custom identifier's value" do
|
30
30
|
manifestation = FactoryBot.create(:manifestation)
|
31
|
-
|
32
|
-
identifier = FactoryBot.create(:identifier, identifier_type:
|
31
|
+
custom = IdentifierType.find_by(name: "custom")
|
32
|
+
identifier = FactoryBot.create(:identifier, identifier_type: custom, body: "a11223344")
|
33
33
|
export_file = ResourceExportFile.new
|
34
34
|
export_file.user = users(:admin)
|
35
35
|
export_file.save!
|
@@ -37,8 +37,8 @@ describe ResourceExportFile do
|
|
37
37
|
file = export_file.resource_export
|
38
38
|
expect(file).to be_truthy
|
39
39
|
lines = File.open(file.path).readlines.map(&:chomp)
|
40
|
-
expect(lines.first.split(/\t/)).to include "
|
41
|
-
expect(lines.last.split(/\t/)).to include "
|
40
|
+
expect(lines.first.split(/\t/)).to include "identifier:custom"
|
41
|
+
expect(lines.last.split(/\t/)).to include "a11223344"
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should export carrier_type" do
|
@@ -50,9 +50,7 @@ describe ResourceExportFile do
|
|
50
50
|
export_file.save!
|
51
51
|
export_file.export!
|
52
52
|
file = export_file.resource_export
|
53
|
-
|
54
|
-
csv = CSV.open(file.path, {headers: true, col_sep: "\t"})
|
55
|
-
csv.each do |row|
|
53
|
+
CSV.open(file.path, {headers: true, col_sep: "\t"}).each do |row|
|
56
54
|
expect(row).to have_key "carrier_type"
|
57
55
|
case row["manifestation_id"].to_i
|
58
56
|
when 1
|
@@ -62,6 +60,61 @@ describe ResourceExportFile do
|
|
62
60
|
end
|
63
61
|
end
|
64
62
|
end
|
63
|
+
|
64
|
+
it "should export create_type, realize_type and produce_type" do
|
65
|
+
export_file = ResourceExportFile.new
|
66
|
+
export_file.user = users(:admin)
|
67
|
+
export_file.save!
|
68
|
+
export_file.export!
|
69
|
+
file = export_file.resource_export
|
70
|
+
CSV.open(file.path, {headers: true, col_sep: "\t"}).each do |row|
|
71
|
+
manifestation = Manifestation.find(row['manifestation_id'])
|
72
|
+
manifestation.creates.each do |create|
|
73
|
+
if create.create_type
|
74
|
+
expect(row['creator']).to match "#{create.agent.full_name}||#{create.create_type.name}"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
manifestation.realizes.each do |realize|
|
79
|
+
if realize.realize_type
|
80
|
+
expect(row['contributor']).to match "#{realize.agent.full_name}||#{realize.realize_type.name}"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
manifestation.produces.each do |produce|
|
85
|
+
if produce.produce_type
|
86
|
+
expect(row['publisher']).to match "#{produce.agent.full_name}||#{produce.produce_type.name}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should export custom properties" do
|
93
|
+
item = FactoryBot.create(:item)
|
94
|
+
3.times do
|
95
|
+
item.manifestation.manifestation_custom_values << FactoryBot.build(:manifestation_custom_value)
|
96
|
+
end
|
97
|
+
3.times do
|
98
|
+
item.item_custom_values << FactoryBot.build(:item_custom_value)
|
99
|
+
end
|
100
|
+
export_file = ResourceExportFile.new
|
101
|
+
export_file.user = users(:admin)
|
102
|
+
export_file.save!
|
103
|
+
export_file.export!
|
104
|
+
file = export_file.resource_export
|
105
|
+
CSV.open(file.path, {headers: true, col_sep: "\t"}).each do |row|
|
106
|
+
if row['manifestation_id'] == item.manifestation.id
|
107
|
+
item.manifestation_custom_values.each do |value|
|
108
|
+
expect(row).to have_key "manifestation:#{value.manifestation_custom_property.name}"
|
109
|
+
expect(row["manifestation:#{value.manifestation_custom_property.name}"]).to eq value
|
110
|
+
end
|
111
|
+
item.item_custom_values.each do |value|
|
112
|
+
expect(row).to have_key "item:#{value.item_custom_property.name}"
|
113
|
+
expect(row["item:#{value.item_custom_property.name}"]).to eq value
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
65
118
|
end
|
66
119
|
|
67
120
|
# == Schema Information
|
@@ -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 '
|
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:
|
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 +
|
225
|
-
Item.count.should eq old_items_count +
|
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 +
|
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
|
-
|
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
|
-
|
348
|
-
|
349
|
-
|
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').
|
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
|
-
|
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
|