enju_biblio 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/picture_files_controller.rb +1 -1
- data/app/models/item.rb +1 -1
- data/app/models/manifestation.rb +22 -2
- data/app/models/resource_import_file.rb +4 -4
- data/db/migrate/20171119051258_set_not_null_to_manifestation_id_on_items.rb +5 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/cassette_library/ImportRequest/import/should_import_bibliographic_record.yml +38 -655
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/should_import_without_errors.yml +43 -191
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_isbn_which_is_already_imported/redirects_to_the_created_import_request.yml +40 -592
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/assigns_a_newly_created_import_request_as_import_request.yml +37 -589
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/redirects_to_the_created_import_request.yml +41 -593
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/assigns_a_newly_created_import_request_as_import_request.yml +39 -591
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/redirects_to_the_created_import_request.yml +39 -591
- data/spec/cassette_library/ResourceImportFile/should_import_in_background.yml +40 -425
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/ISBN_import/with_record_not_found/should_record_an_error_message.yml +39 -75
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_has_only_isbn/should_be_imported.yml +39 -705
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_shift_jis/should_be_imported.yml +39 -424
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_be_imported.yml +37 -422
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_be_searchable_right_after_the_import.yml +41 -426
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_send_message_when_import_is_completed.yml +39 -424
- data/spec/controllers/agent_merge_lists_controller_spec.rb +9 -9
- data/spec/controllers/agent_merges_controller_spec.rb +13 -13
- data/spec/controllers/agent_relationship_types_controller_spec.rb +12 -12
- data/spec/controllers/agent_relationships_controller_spec.rb +12 -12
- data/spec/controllers/agent_types_controller_spec.rb +1 -1
- data/spec/controllers/agents_controller_spec.rb +6 -6
- data/spec/controllers/carrier_types_controller_spec.rb +1 -1
- data/spec/controllers/content_types_controller_spec.rb +3 -3
- data/spec/controllers/countries_controller_spec.rb +9 -9
- data/spec/controllers/create_types_controller_spec.rb +1 -1
- data/spec/controllers/creates_controller_spec.rb +11 -11
- data/spec/controllers/donates_controller_spec.rb +11 -11
- data/spec/controllers/form_of_works_controller_spec.rb +1 -1
- data/spec/controllers/frequencies_controller_spec.rb +3 -3
- data/spec/controllers/identifier_types_controller_spec.rb +1 -1
- data/spec/controllers/import_requests_controller_spec.rb +5 -5
- data/spec/controllers/items_controller_spec.rb +15 -15
- data/spec/controllers/languages_controller_spec.rb +6 -6
- data/spec/controllers/licenses_controller_spec.rb +1 -1
- data/spec/controllers/manifestation_relationship_types_controller_spec.rb +12 -12
- data/spec/controllers/manifestation_relationships_controller_spec.rb +12 -12
- data/spec/controllers/manifestations_controller_spec.rb +29 -29
- data/spec/controllers/medium_of_performances_controller_spec.rb +1 -1
- data/spec/controllers/owns_controller_spec.rb +12 -12
- data/spec/controllers/produce_types_controller_spec.rb +1 -1
- data/spec/controllers/produces_controller_spec.rb +10 -10
- data/spec/controllers/realize_types_controller_spec.rb +1 -1
- data/spec/controllers/realizes_controller_spec.rb +11 -11
- data/spec/controllers/series_statement_merge_lists_controller_spec.rb +12 -12
- data/spec/controllers/series_statement_merges_controller_spec.rb +12 -12
- data/spec/controllers/series_statements_controller_spec.rb +11 -11
- data/spec/dummy/db/migrate/20171014084528_add_header_logo_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20171126133835_rename_login_banner_to_old_login_banner.rb +5 -0
- data/spec/dummy/db/migrate/20171126135238_add_foreign_key_to_library_group_id_on_library.rb +5 -0
- data/spec/dummy/db/schema.rb +7 -3
- data/spec/factories/agent.rb +2 -2
- data/spec/factories/agent_merge.rb +3 -3
- data/spec/factories/agent_merge_list.rb +1 -1
- data/spec/factories/basket.rb +2 -2
- data/spec/factories/carrier_type.rb +1 -1
- data/spec/factories/checkout.rb +1 -1
- data/spec/factories/classification.rb +2 -2
- data/spec/factories/classification_type.rb +1 -1
- data/spec/factories/content_type.rb +1 -1
- data/spec/factories/country.rb +1 -1
- data/spec/factories/create.rb +3 -3
- data/spec/factories/create_types.rb +1 -1
- data/spec/factories/donate.rb +3 -3
- data/spec/factories/form_of_work.rb +1 -1
- data/spec/factories/frequency.rb +1 -1
- data/spec/factories/identifier.rb +2 -2
- data/spec/factories/identifier_type.rb +1 -1
- data/spec/factories/import_request.rb +1 -1
- data/spec/factories/item.rb +2 -2
- data/spec/factories/language.rb +1 -1
- data/spec/factories/library.rb +2 -2
- data/spec/factories/license.rb +1 -1
- data/spec/factories/manifestation.rb +2 -2
- data/spec/factories/manifestation_relationship.rb +3 -3
- data/spec/factories/manifestation_relationship_type.rb +1 -1
- data/spec/factories/medium_of_performance.rb +1 -1
- data/spec/factories/own.rb +3 -3
- data/spec/factories/patron_relationship.rb +3 -3
- data/spec/factories/patron_relationship_type.rb +1 -1
- data/spec/factories/patron_type.rb +1 -1
- data/spec/factories/produce.rb +3 -3
- data/spec/factories/produce_types.rb +1 -1
- data/spec/factories/profile.rb +2 -2
- data/spec/factories/realize.rb +3 -3
- data/spec/factories/realize_types.rb +1 -1
- data/spec/factories/reserve.rb +5 -5
- data/spec/factories/role.rb +1 -1
- data/spec/factories/series_has_manifestation.rb +3 -3
- data/spec/factories/series_statement.rb +2 -2
- data/spec/factories/series_statement_merge.rb +3 -3
- data/spec/factories/series_statement_merge_list.rb +1 -1
- data/spec/factories/series_statement_relationship.rb +3 -3
- data/spec/factories/shelf.rb +2 -2
- data/spec/factories/subject.rb +3 -3
- data/spec/factories/subject_heading_type.rb +1 -1
- data/spec/factories/subject_heading_type_has_subject.rb +3 -3
- data/spec/factories/subject_type.rb +1 -1
- data/spec/factories/user.rb +1 -1
- data/spec/fixtures/items.yml +1 -1
- data/spec/fixtures/library_groups.yml +1 -1
- data/spec/models/agent_spec.rb +4 -4
- data/spec/models/create_type_spec.rb +1 -1
- data/spec/models/item_spec.rb +1 -1
- data/spec/models/manifestation_spec.rb +30 -6
- data/spec/models/produce_type_spec.rb +1 -1
- data/spec/models/realize_type_spec.rb +1 -1
- data/spec/models/resource_export_file_spec.rb +7 -7
- data/spec/models/resource_import_file_spec.rb +19 -0
- data/spec/models/series_statement_spec.rb +1 -1
- data/spec/policies/manifestation_policy_spec.rb +5 -5
- data/spec/rails_helper.rb +3 -3
- data/spec/support/controller_macros.rb +3 -3
- data/spec/views/items/index.html.erb_spec.rb +2 -2
- data/spec/views/manifestations/index.html.erb_spec.rb +1 -1
- data/spec/views/manifestations/index.rdf.builder_spec.rb +1 -1
- data/spec/views/manifestations/index.txt.erb_spec.rb +2 -2
- data/spec/views/manifestations/show.html.erb_spec.rb +5 -5
- data/spec/views/manifestations/show.txt.erb_spec.rb +1 -1
- data/spec/views/series_statement_merges/show.html.erb_spec.rb +1 -1
- metadata +23 -16
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :agent_merge do |f|
|
3
|
-
f.agent_merge_list_id{
|
4
|
-
f.agent_id{
|
3
|
+
f.agent_merge_list_id{FactoryBot.create(:agent_merge_list).id}
|
4
|
+
f.agent_id{FactoryBot.create(:agent).id}
|
5
5
|
end
|
6
6
|
end
|
data/spec/factories/basket.rb
CHANGED
data/spec/factories/checkout.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :classification do |f|
|
3
3
|
f.sequence(:category){|n| "classification_#{n}"}
|
4
|
-
f.classification_type_id{
|
4
|
+
f.classification_type_id{FactoryBot.create(:classification_type).id}
|
5
5
|
end
|
6
6
|
end
|
data/spec/factories/country.rb
CHANGED
data/spec/factories/create.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :create do |f|
|
3
|
-
f.work_id{
|
4
|
-
f.agent_id{
|
3
|
+
f.work_id{FactoryBot.create(:manifestation).id}
|
4
|
+
f.agent_id{FactoryBot.create(:agent).id}
|
5
5
|
end
|
6
6
|
end
|
data/spec/factories/donate.rb
CHANGED
data/spec/factories/frequency.rb
CHANGED
data/spec/factories/item.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :item do |f|
|
3
3
|
f.sequence(:item_identifier){|n| "item_#{n}"}
|
4
4
|
f.circulation_status_id{CirculationStatus.find(1).id}
|
5
|
-
f.manifestation_id{
|
5
|
+
f.manifestation_id{FactoryBot.create(:manifestation).id}
|
6
6
|
end
|
7
7
|
end
|
data/spec/factories/language.rb
CHANGED
data/spec/factories/library.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :library do |f|
|
3
3
|
f.sequence(:name){|n| "library#{n}"}
|
4
4
|
f.sequence(:short_display_name){|n| "library_#{n}"}
|
@@ -6,7 +6,7 @@ FactoryGirl.define do
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
|
9
|
+
FactoryBot.define do
|
10
10
|
factory :invalid_library, :class => Library do |f|
|
11
11
|
f.library_group_id{LibraryGroup.first.id}
|
12
12
|
end
|
data/spec/factories/license.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :manifestation do |f|
|
3
3
|
f.sequence(:original_title){|n| "manifestation_title_#{n}"}
|
4
4
|
f.carrier_type_id{CarrierType.find(1).id}
|
@@ -9,6 +9,6 @@ FactoryGirl.define do
|
|
9
9
|
f.carrier_type_id{CarrierType.find(1).id}
|
10
10
|
f.language_id{Language.find(1).id}
|
11
11
|
f.serial{true}
|
12
|
-
f.series_statements{[
|
12
|
+
f.series_statements{[FactoryBot.create(:series_statement_serial)]}
|
13
13
|
end
|
14
14
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :manifestation_relationship do |f|
|
3
|
-
f.parent_id{
|
4
|
-
f.child_id{
|
3
|
+
f.parent_id{FactoryBot.create(:manifestation).id}
|
4
|
+
f.child_id{FactoryBot.create(:manifestation).id}
|
5
5
|
end
|
6
6
|
end
|
data/spec/factories/own.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :agent_relationship do |f|
|
3
|
-
f.parent_id{
|
4
|
-
f.child_id{
|
3
|
+
f.parent_id{FactoryBot.create(:agent).id}
|
4
|
+
f.child_id{FactoryBot.create(:agent).id}
|
5
5
|
end
|
6
6
|
end
|
data/spec/factories/produce.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :produce do |f|
|
3
|
-
f.manifestation_id{
|
4
|
-
f.agent_id{
|
3
|
+
f.manifestation_id{FactoryBot.create(:manifestation).id}
|
4
|
+
f.agent_id{FactoryBot.create(:agent).id}
|
5
5
|
end
|
6
6
|
end
|
data/spec/factories/profile.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :profile, :class => Profile do |f|
|
3
3
|
f.user_group_id {UserGroup.first.id}
|
4
4
|
f.required_role_id {Role.where(name: 'User').first.id}
|
5
5
|
f.sequence(:user_number){|n| "user_number_#{n}"}
|
6
6
|
f.library_id 2
|
7
7
|
f.locale "ja"
|
8
|
-
f.user_id {
|
8
|
+
f.user_id {FactoryBot.create(:user).id}
|
9
9
|
end
|
10
10
|
end
|
data/spec/factories/realize.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :realize do |f|
|
3
|
-
f.expression_id{
|
4
|
-
f.agent_id{
|
3
|
+
f.expression_id{FactoryBot.create(:manifestation).id}
|
4
|
+
f.agent_id{FactoryBot.create(:agent).id}
|
5
5
|
end
|
6
6
|
end
|
data/spec/factories/reserve.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :reserve do |f|
|
3
3
|
before(:create) do |reserve|
|
4
|
-
profile =
|
5
|
-
user =
|
4
|
+
profile = FactoryBot.create(:profile)
|
5
|
+
user = FactoryBot.create(:admin)
|
6
6
|
user.profile = profile
|
7
7
|
reserve.user = user
|
8
8
|
end
|
9
|
-
f.manifestation_id{
|
10
|
-
# f.user{
|
9
|
+
f.manifestation_id{FactoryBot.create(:manifestation).id}
|
10
|
+
# f.user{FactoryBot.create(:user)}
|
11
11
|
end
|
12
12
|
end
|
data/spec/factories/role.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :series_has_manifestation do |f|
|
3
|
-
f.manifestation_id{
|
4
|
-
f.series_statement_id{
|
3
|
+
f.manifestation_id{FactoryBot.create(:manifestation).id}
|
4
|
+
f.series_statement_id{FactoryBot.create(:series_statement).id}
|
5
5
|
end
|
6
6
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :series_statement do |f|
|
3
3
|
f.sequence(:original_title){|n| "series_statement_#{n}"}
|
4
4
|
end
|
5
5
|
factory :series_statement_serial, class: SeriesStatement do |f|
|
6
6
|
f.sequence(:original_title){|n| "series_statement_serial_#{n}" }
|
7
|
-
#f.root_manifestation_id{
|
7
|
+
#f.root_manifestation_id{FactoryBot.create(:manifestation_serial).id}
|
8
8
|
f.series_master{true}
|
9
9
|
end
|
10
10
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :series_statement_merge do |f|
|
3
|
-
f.series_statement_merge_list_id{
|
4
|
-
f.series_statement_id{
|
3
|
+
f.series_statement_merge_list_id{FactoryBot.create(:series_statement_merge_list).id}
|
4
|
+
f.series_statement_id{FactoryBot.create(:series_statement).id}
|
5
5
|
end
|
6
6
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
2
2
|
|
3
|
-
|
3
|
+
FactoryBot.define do
|
4
4
|
factory :series_statement_relationship do |f|
|
5
|
-
f.parent_id{
|
6
|
-
f.child_id{
|
5
|
+
f.parent_id{FactoryBot.create(:series_statement).id}
|
6
|
+
f.child_id{FactoryBot.create(:series_statement).id}
|
7
7
|
end
|
8
8
|
end
|
data/spec/factories/shelf.rb
CHANGED
data/spec/factories/subject.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :subject do |f|
|
3
3
|
f.sequence(:term){|n| "subject_#{n}"}
|
4
|
-
f.subject_heading_type_id{
|
5
|
-
f.subject_type_id{
|
4
|
+
f.subject_heading_type_id{FactoryBot.create(:subject_heading_type).id}
|
5
|
+
f.subject_type_id{FactoryBot.create(:subject_type).id}
|
6
6
|
end
|
7
7
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :subject_heading_type_has_subject do |f|
|
3
|
-
f.subject_heading_type_id{
|
4
|
-
f.subject_id{
|
3
|
+
f.subject_heading_type_id{FactoryBot.create(:subject_heading_type).id}
|
4
|
+
f.subject_id{FactoryBot.create(:subject).id}
|
5
5
|
end
|
6
6
|
end
|
data/spec/factories/user.rb
CHANGED
data/spec/fixtures/items.yml
CHANGED
data/spec/models/agent_spec.rb
CHANGED
@@ -6,22 +6,22 @@ describe Agent do
|
|
6
6
|
fixtures :all
|
7
7
|
|
8
8
|
it "should set a default required_role to Guest" do
|
9
|
-
agent =
|
9
|
+
agent = FactoryBot.create(:agent)
|
10
10
|
agent.required_role.should eq Role.find_by_name('Guest')
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should set birth_date" do
|
14
|
-
agent =
|
14
|
+
agent = FactoryBot.create(:agent, :birth_date => '2000')
|
15
15
|
agent.date_of_birth.should eq Time.zone.parse('2000-01-01')
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should set death_date" do
|
19
|
-
agent =
|
19
|
+
agent = FactoryBot.create(:agent, :death_date => '2000')
|
20
20
|
agent.date_of_death.should eq Time.zone.parse('2000-01-01')
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should not set death_date earlier than birth_date" do
|
24
|
-
agent =
|
24
|
+
agent = FactoryBot.create(:agent, :birth_date => '2010', :death_date => '2000')
|
25
25
|
agent.should_not be_valid
|
26
26
|
end
|
27
27
|
|
data/spec/models/item_spec.rb
CHANGED
@@ -8,20 +8,20 @@ describe Manifestation, :solr => true do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should set year_of_publication" do
|
11
|
-
manifestation =
|
11
|
+
manifestation = FactoryBot.create(:manifestation, :pub_date => '2000')
|
12
12
|
manifestation.year_of_publication.should eq 2000
|
13
13
|
manifestation.date_of_publication.should eq Time.zone.parse('2000-01-01')
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should set date_of_publication" do
|
17
|
-
manifestation =
|
17
|
+
manifestation = FactoryBot.create(:manifestation, :pub_date => '2000-01')
|
18
18
|
manifestation.year_of_publication.should eq 2000
|
19
19
|
manifestation.month_of_publication.should eq 1
|
20
20
|
manifestation.date_of_publication.should eq Time.zone.parse('2000-01-01')
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should set volume_number" do
|
24
|
-
manifestation =
|
24
|
+
manifestation = FactoryBot.create(:manifestation, :volume_number_string => '第1巻', :issue_number_string => '20号分冊1', :edition_string => '第3版')
|
25
25
|
manifestation.volume_number.should eq 1
|
26
26
|
manifestation.issue_number.should eq 20
|
27
27
|
manifestation.edition.should eq 3
|
@@ -241,7 +241,7 @@ describe Manifestation, :solr => true do
|
|
241
241
|
end
|
242
242
|
|
243
243
|
it "should export edition fields" do
|
244
|
-
manifestation =
|
244
|
+
manifestation = FactoryBot.create(:manifestation, edition: 2, edition_string: "Revised Ed.")
|
245
245
|
lines = Manifestation.export
|
246
246
|
csv = CSV.parse(lines, headers: true, col_sep: "\t")
|
247
247
|
expect(csv["edition"].compact).not_to be_empty
|
@@ -251,16 +251,26 @@ describe Manifestation, :solr => true do
|
|
251
251
|
expect(m["edition_string"]).to eq "Revised Ed."
|
252
252
|
end
|
253
253
|
it "should export title_transcription fields" do
|
254
|
-
manifestation =
|
254
|
+
manifestation = FactoryBot.create(:manifestation, title_transcription: "Transcripted title")
|
255
255
|
lines = Manifestation.export
|
256
256
|
csv = CSV.parse(lines, headers: true, col_sep: "\t")
|
257
257
|
expect(csv["title_transcription"].compact).not_to be_empty
|
258
258
|
m = csv.find{|row| row["manifestation_id"].to_i == manifestation.id }
|
259
259
|
expect(m["title_transcription"]).to eq "Transcripted title"
|
260
260
|
end
|
261
|
+
it "should export volume fields" do
|
262
|
+
manifestation = FactoryBot.create(:manifestation, volume_number: 15, volume_number_string: "Vol.15")
|
263
|
+
lines = Manifestation.export
|
264
|
+
csv = CSV.parse(lines, headers: true, col_sep: "\t")
|
265
|
+
expect(csv["volume_number"].compact).not_to be_empty
|
266
|
+
expect(csv["volume_number_string"].compact).not_to be_empty
|
267
|
+
m = csv.find{|row| row["manifestation_id"].to_i == manifestation.id }
|
268
|
+
expect(m["volume_number"]).to eq "15"
|
269
|
+
expect(m["volume_number_string"]).to eq "Vol.15"
|
270
|
+
end
|
261
271
|
|
262
272
|
it "should respect the role of the user" do
|
263
|
-
|
273
|
+
FactoryBot.create(:item, bookstore_id: 1, price: 100, budget_type_id: 1)
|
264
274
|
lines = Manifestation.export
|
265
275
|
csv = CSV.parse(lines, headers: true, col_sep: "\t")
|
266
276
|
expect(csv["bookstore"].compact).to be_empty
|
@@ -273,6 +283,20 @@ describe Manifestation, :solr => true do
|
|
273
283
|
expect(csv["item_price"].compact).not_to be_empty
|
274
284
|
expect(csv["budget_type"].compact).not_to be_empty
|
275
285
|
end
|
286
|
+
|
287
|
+
it 'should escape LF/CR to "\n"' do
|
288
|
+
manifestation = FactoryBot.create(:manifestation, description: "test\ntest", note: "test\ntest")
|
289
|
+
item = FactoryBot.create(:item, manifestation: manifestation, note: "test\ntest")
|
290
|
+
lines = Manifestation.export
|
291
|
+
csv = CSV.parse(lines, headers: true, col_sep: "\t")
|
292
|
+
expect(csv["description"].compact).not_to be_empty
|
293
|
+
expect(csv["note"].compact).not_to be_empty
|
294
|
+
expect(csv["item_note"].compact).not_to be_empty
|
295
|
+
m = csv.find{|row| row["manifestation_id"].to_i == manifestation.id }
|
296
|
+
expect(m["description"]).to eq 'test\ntest'
|
297
|
+
expect(m["note"]).to eq 'test\ntest'
|
298
|
+
expect(m["item_note"]).to eq 'test\ntest'
|
299
|
+
end
|
276
300
|
end
|
277
301
|
|
278
302
|
if defined?(EnjuCirculation)
|