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.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/picture_files_controller.rb +1 -1
  3. data/app/models/item.rb +1 -1
  4. data/app/models/manifestation.rb +22 -2
  5. data/app/models/resource_import_file.rb +4 -4
  6. data/db/migrate/20171119051258_set_not_null_to_manifestation_id_on_items.rb +5 -0
  7. data/lib/enju_biblio/version.rb +1 -1
  8. data/spec/cassette_library/ImportRequest/import/should_import_bibliographic_record.yml +38 -655
  9. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/should_import_without_errors.yml +43 -191
  10. 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
  11. 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
  12. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/redirects_to_the_created_import_request.yml +41 -593
  13. 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
  14. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/redirects_to_the_created_import_request.yml +39 -591
  15. data/spec/cassette_library/ResourceImportFile/should_import_in_background.yml +40 -425
  16. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/ISBN_import/with_record_not_found/should_record_an_error_message.yml +39 -75
  17. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_has_only_isbn/should_be_imported.yml +39 -705
  18. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_shift_jis/should_be_imported.yml +39 -424
  19. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_be_imported.yml +37 -422
  20. 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
  21. 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
  22. data/spec/controllers/agent_merge_lists_controller_spec.rb +9 -9
  23. data/spec/controllers/agent_merges_controller_spec.rb +13 -13
  24. data/spec/controllers/agent_relationship_types_controller_spec.rb +12 -12
  25. data/spec/controllers/agent_relationships_controller_spec.rb +12 -12
  26. data/spec/controllers/agent_types_controller_spec.rb +1 -1
  27. data/spec/controllers/agents_controller_spec.rb +6 -6
  28. data/spec/controllers/carrier_types_controller_spec.rb +1 -1
  29. data/spec/controllers/content_types_controller_spec.rb +3 -3
  30. data/spec/controllers/countries_controller_spec.rb +9 -9
  31. data/spec/controllers/create_types_controller_spec.rb +1 -1
  32. data/spec/controllers/creates_controller_spec.rb +11 -11
  33. data/spec/controllers/donates_controller_spec.rb +11 -11
  34. data/spec/controllers/form_of_works_controller_spec.rb +1 -1
  35. data/spec/controllers/frequencies_controller_spec.rb +3 -3
  36. data/spec/controllers/identifier_types_controller_spec.rb +1 -1
  37. data/spec/controllers/import_requests_controller_spec.rb +5 -5
  38. data/spec/controllers/items_controller_spec.rb +15 -15
  39. data/spec/controllers/languages_controller_spec.rb +6 -6
  40. data/spec/controllers/licenses_controller_spec.rb +1 -1
  41. data/spec/controllers/manifestation_relationship_types_controller_spec.rb +12 -12
  42. data/spec/controllers/manifestation_relationships_controller_spec.rb +12 -12
  43. data/spec/controllers/manifestations_controller_spec.rb +29 -29
  44. data/spec/controllers/medium_of_performances_controller_spec.rb +1 -1
  45. data/spec/controllers/owns_controller_spec.rb +12 -12
  46. data/spec/controllers/produce_types_controller_spec.rb +1 -1
  47. data/spec/controllers/produces_controller_spec.rb +10 -10
  48. data/spec/controllers/realize_types_controller_spec.rb +1 -1
  49. data/spec/controllers/realizes_controller_spec.rb +11 -11
  50. data/spec/controllers/series_statement_merge_lists_controller_spec.rb +12 -12
  51. data/spec/controllers/series_statement_merges_controller_spec.rb +12 -12
  52. data/spec/controllers/series_statements_controller_spec.rb +11 -11
  53. data/spec/dummy/db/migrate/20171014084528_add_header_logo_to_library_group.rb +5 -0
  54. data/spec/dummy/db/migrate/20171126133835_rename_login_banner_to_old_login_banner.rb +5 -0
  55. data/spec/dummy/db/migrate/20171126135238_add_foreign_key_to_library_group_id_on_library.rb +5 -0
  56. data/spec/dummy/db/schema.rb +7 -3
  57. data/spec/factories/agent.rb +2 -2
  58. data/spec/factories/agent_merge.rb +3 -3
  59. data/spec/factories/agent_merge_list.rb +1 -1
  60. data/spec/factories/basket.rb +2 -2
  61. data/spec/factories/carrier_type.rb +1 -1
  62. data/spec/factories/checkout.rb +1 -1
  63. data/spec/factories/classification.rb +2 -2
  64. data/spec/factories/classification_type.rb +1 -1
  65. data/spec/factories/content_type.rb +1 -1
  66. data/spec/factories/country.rb +1 -1
  67. data/spec/factories/create.rb +3 -3
  68. data/spec/factories/create_types.rb +1 -1
  69. data/spec/factories/donate.rb +3 -3
  70. data/spec/factories/form_of_work.rb +1 -1
  71. data/spec/factories/frequency.rb +1 -1
  72. data/spec/factories/identifier.rb +2 -2
  73. data/spec/factories/identifier_type.rb +1 -1
  74. data/spec/factories/import_request.rb +1 -1
  75. data/spec/factories/item.rb +2 -2
  76. data/spec/factories/language.rb +1 -1
  77. data/spec/factories/library.rb +2 -2
  78. data/spec/factories/license.rb +1 -1
  79. data/spec/factories/manifestation.rb +2 -2
  80. data/spec/factories/manifestation_relationship.rb +3 -3
  81. data/spec/factories/manifestation_relationship_type.rb +1 -1
  82. data/spec/factories/medium_of_performance.rb +1 -1
  83. data/spec/factories/own.rb +3 -3
  84. data/spec/factories/patron_relationship.rb +3 -3
  85. data/spec/factories/patron_relationship_type.rb +1 -1
  86. data/spec/factories/patron_type.rb +1 -1
  87. data/spec/factories/produce.rb +3 -3
  88. data/spec/factories/produce_types.rb +1 -1
  89. data/spec/factories/profile.rb +2 -2
  90. data/spec/factories/realize.rb +3 -3
  91. data/spec/factories/realize_types.rb +1 -1
  92. data/spec/factories/reserve.rb +5 -5
  93. data/spec/factories/role.rb +1 -1
  94. data/spec/factories/series_has_manifestation.rb +3 -3
  95. data/spec/factories/series_statement.rb +2 -2
  96. data/spec/factories/series_statement_merge.rb +3 -3
  97. data/spec/factories/series_statement_merge_list.rb +1 -1
  98. data/spec/factories/series_statement_relationship.rb +3 -3
  99. data/spec/factories/shelf.rb +2 -2
  100. data/spec/factories/subject.rb +3 -3
  101. data/spec/factories/subject_heading_type.rb +1 -1
  102. data/spec/factories/subject_heading_type_has_subject.rb +3 -3
  103. data/spec/factories/subject_type.rb +1 -1
  104. data/spec/factories/user.rb +1 -1
  105. data/spec/fixtures/items.yml +1 -1
  106. data/spec/fixtures/library_groups.yml +1 -1
  107. data/spec/models/agent_spec.rb +4 -4
  108. data/spec/models/create_type_spec.rb +1 -1
  109. data/spec/models/item_spec.rb +1 -1
  110. data/spec/models/manifestation_spec.rb +30 -6
  111. data/spec/models/produce_type_spec.rb +1 -1
  112. data/spec/models/realize_type_spec.rb +1 -1
  113. data/spec/models/resource_export_file_spec.rb +7 -7
  114. data/spec/models/resource_import_file_spec.rb +19 -0
  115. data/spec/models/series_statement_spec.rb +1 -1
  116. data/spec/policies/manifestation_policy_spec.rb +5 -5
  117. data/spec/rails_helper.rb +3 -3
  118. data/spec/support/controller_macros.rb +3 -3
  119. data/spec/views/items/index.html.erb_spec.rb +2 -2
  120. data/spec/views/manifestations/index.html.erb_spec.rb +1 -1
  121. data/spec/views/manifestations/index.rdf.builder_spec.rb +1 -1
  122. data/spec/views/manifestations/index.txt.erb_spec.rb +2 -2
  123. data/spec/views/manifestations/show.html.erb_spec.rb +5 -5
  124. data/spec/views/manifestations/show.txt.erb_spec.rb +1 -1
  125. data/spec/views/series_statement_merges/show.html.erb_spec.rb +1 -1
  126. metadata +23 -16
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :agent_merge do |f|
3
- f.agent_merge_list_id{FactoryGirl.create(:agent_merge_list).id}
4
- f.agent_id{FactoryGirl.create(: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
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :agent_merge_list do |f|
3
3
  f.sequence(:title){|n| "agent_merge_list_#{n}"}
4
4
  end
@@ -1,5 +1,5 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :basket do |f|
3
- f.user_id{FactoryGirl.create(:user).id}
3
+ f.user_id{FactoryBot.create(:user).id}
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :carrier_type do |f|
3
3
  f.sequence(:name){|n| "carrier_type_#{n}"}
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :checkout, :class => Checkout do |f|
3
3
  f.due_date Time.zone.now.next_week
4
4
  f.association :item, factory: :item
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :classification do |f|
3
3
  f.sequence(:category){|n| "classification_#{n}"}
4
- f.classification_type_id{FactoryGirl.create(:classification_type).id}
4
+ f.classification_type_id{FactoryBot.create(:classification_type).id}
5
5
  end
6
6
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :classification_type do |f|
3
3
  f.sequence(:name){|n| "classification_type_#{n}"}
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :content_type do |f|
3
3
  f.sequence(:name){|n| "content_type_#{n}"}
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :country do |f|
3
3
  f.sequence(:name){|n| "country_#{n}"}
4
4
  f.sequence(:alpha_2){|n| "alpha_2_#{n}"}
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :create do |f|
3
- f.work_id{FactoryGirl.create(:manifestation).id}
4
- f.agent_id{FactoryGirl.create(:agent).id}
3
+ f.work_id{FactoryBot.create(:manifestation).id}
4
+ f.agent_id{FactoryBot.create(:agent).id}
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # Read about factories at http://github.com/thoughtbot/factory_girl
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :create_type do
5
5
  name "mystring"
6
6
  display_name "MyText"
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :donate do |f|
3
- f.item_id{FactoryGirl.create(:item).id}
4
- f.agent_id{FactoryGirl.create(:agent).id}
3
+ f.item_id{FactoryBot.create(:item).id}
4
+ f.agent_id{FactoryBot.create(:agent).id}
5
5
  end
6
6
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :form_of_work do |f|
3
3
  f.sequence(:name){|n| "form_of_work_#{n}"}
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :frequency do |f|
3
3
  f.sequence(:name){|n| "frequency_#{n}"}
4
4
  end
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :identifier do |f|
3
3
  f.sequence(:body){|n| "identifier_body_#{n}"}
4
- f.identifier_type_id{FactoryGirl.create(:identifier_type).id}
4
+ f.identifier_type_id{FactoryBot.create(:identifier_type).id}
5
5
  end
6
6
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :identifier_type do |f|
3
3
  f.sequence(:name){|n| "identifier_type_#{n}"}
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :import_request do |f|
3
3
  f.sequence(:isbn){|n| "isbn_#{n}"}
4
4
  end
@@ -1,7 +1,7 @@
1
- FactoryGirl.define do
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{FactoryGirl.create(:manifestation).id}
5
+ f.manifestation_id{FactoryBot.create(:manifestation).id}
6
6
  end
7
7
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :language do |f|
3
3
  f.sequence(:name){|n| "language_#{n}"}
4
4
  f.sequence(:iso_639_1){|n| "639_1_#{n}"}
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
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
- FactoryGirl.define do
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
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :license do |f|
3
3
  f.sequence(:name){|n| "license_#{n}"}
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
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{[FactoryGirl.create(:series_statement_serial)]}
12
+ f.series_statements{[FactoryBot.create(:series_statement_serial)]}
13
13
  end
14
14
  end
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :manifestation_relationship do |f|
3
- f.parent_id{FactoryGirl.create(:manifestation).id}
4
- f.child_id{FactoryGirl.create(:manifestation).id}
3
+ f.parent_id{FactoryBot.create(:manifestation).id}
4
+ f.child_id{FactoryBot.create(:manifestation).id}
5
5
  end
6
6
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :manifestation_relationship_type do |f|
3
3
  f.sequence(:name){|n| "manifestation_relationship_type_#{n}"}
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :medium_of_performance do |f|
3
3
  f.sequence(:name){|n| "medium_of_performance_#{n}"}
4
4
  end
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :own do |f|
3
- f.item_id{FactoryGirl.create(:item).id}
4
- f.agent_id{FactoryGirl.create(:agent).id}
3
+ f.item_id{FactoryBot.create(:item).id}
4
+ f.agent_id{FactoryBot.create(:agent).id}
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :agent_relationship do |f|
3
- f.parent_id{FactoryGirl.create(:agent).id}
4
- f.child_id{FactoryGirl.create(:agent).id}
3
+ f.parent_id{FactoryBot.create(:agent).id}
4
+ f.child_id{FactoryBot.create(:agent).id}
5
5
  end
6
6
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :agent_relationship_type do |f|
3
3
  f.sequence(:name){|n| "agent_relationship_type_#{n}"}
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :agent_type do |f|
3
3
  f.sequence(:name){|n| "agent_type_#{n}"}
4
4
  end
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :produce do |f|
3
- f.manifestation_id{FactoryGirl.create(:manifestation).id}
4
- f.agent_id{FactoryGirl.create(:agent).id}
3
+ f.manifestation_id{FactoryBot.create(:manifestation).id}
4
+ f.agent_id{FactoryBot.create(:agent).id}
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # Read about factories at http://github.com/thoughtbot/factory_girl
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :produce_type do
5
5
  name "mystring"
6
6
  display_name "MyText"
@@ -1,10 +1,10 @@
1
- FactoryGirl.define do
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 {FactoryGirl.create(:user).id}
8
+ f.user_id {FactoryBot.create(:user).id}
9
9
  end
10
10
  end
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :realize do |f|
3
- f.expression_id{FactoryGirl.create(:manifestation).id}
4
- f.agent_id{FactoryGirl.create(:agent).id}
3
+ f.expression_id{FactoryBot.create(:manifestation).id}
4
+ f.agent_id{FactoryBot.create(:agent).id}
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # Read about factories at http://github.com/thoughtbot/factory_girl
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :realize_type do
5
5
  name "mystring"
6
6
  display_name "MyText"
@@ -1,12 +1,12 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :reserve do |f|
3
3
  before(:create) do |reserve|
4
- profile = FactoryGirl.create(:profile)
5
- user = FactoryGirl.create(:admin)
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{FactoryGirl.create(:manifestation).id}
10
- # f.user{FactoryGirl.create(:user)}
9
+ f.manifestation_id{FactoryBot.create(:manifestation).id}
10
+ # f.user{FactoryBot.create(:user)}
11
11
  end
12
12
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :role, :class => Role do |f|
3
3
  f.sequence(:name) do |n|
4
4
  idx = "a"
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :series_has_manifestation do |f|
3
- f.manifestation_id{FactoryGirl.create(:manifestation).id}
4
- f.series_statement_id{FactoryGirl.create(: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
- FactoryGirl.define do
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{FactoryGirl.create(:manifestation_serial).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
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :series_statement_merge do |f|
3
- f.series_statement_merge_list_id{FactoryGirl.create(:series_statement_merge_list).id}
4
- f.series_statement_id{FactoryGirl.create(: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,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :series_statement_merge_list do |f|
3
3
  f.sequence(:title){|n| "series_statement_merge_list_#{n}"}
4
4
  end
@@ -1,8 +1,8 @@
1
1
  # Read about factories at https://github.com/thoughtbot/factory_girl
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :series_statement_relationship do |f|
5
- f.parent_id{FactoryGirl.create(:series_statement).id}
6
- f.child_id{FactoryGirl.create(:series_statement).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
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :shelf do |f|
3
3
  f.sequence(:name){|n| "shelf_#{n}"}
4
- f.library_id{FactoryGirl.create(:library).id}
4
+ f.library_id{FactoryBot.create(:library).id}
5
5
  end
6
6
  end
@@ -1,7 +1,7 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :subject do |f|
3
3
  f.sequence(:term){|n| "subject_#{n}"}
4
- f.subject_heading_type_id{FactoryGirl.create(:subject_heading_type).id}
5
- f.subject_type_id{FactoryGirl.create(: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,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :subject_heading_type do |f|
3
3
  f.sequence(:name){|n| "subject_heading_type_#{n}"}
4
4
  end
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :subject_heading_type_has_subject do |f|
3
- f.subject_heading_type_id{FactoryGirl.create(:subject_heading_type).id}
4
- f.subject_id{FactoryGirl.create(: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
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :subject_type do |f|
3
3
  f.sequence(:name){|n| "subject_type_#{n}"}
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :admin, :class => User do |f|
3
3
  f.sequence(:username){|n| "admin_#{n}"}
4
4
  f.sequence(:email){|n| "admin_#{n}@example.jp"}
@@ -303,5 +303,5 @@ item_00025:
303
303
  # binding_item_identifier :string
304
304
  # binding_call_number :string
305
305
  # binded_at :datetime
306
- # manifestation_id :integer
306
+ # manifestation_id :integer not null
307
307
  #
@@ -9,7 +9,7 @@ one:
9
9
  ::/0"
10
10
  url: "http://localhost:3000/"
11
11
  position: 1
12
- login_banner: "*Next-L Enju*"
12
+ old_login_banner: "*Next-L Enju*"
13
13
  admin_networks: "0.0.0.0/0\r\n\
14
14
  ::/0"
15
15
  user_id: 1
@@ -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 = FactoryGirl.create(: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 = FactoryGirl.create(:agent, :birth_date => '2000')
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 = FactoryGirl.create(:agent, :death_date => '2000')
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 = FactoryGirl.create(:agent, :birth_date => '2010', :death_date => '2000')
24
+ agent = FactoryBot.create(:agent, :birth_date => '2010', :death_date => '2000')
25
25
  agent.should_not be_valid
26
26
  end
27
27
 
@@ -2,7 +2,7 @@ require 'rails_helper'
2
2
 
3
3
  describe CreateType do
4
4
  it 'should create create_type' do
5
- FactoryGirl.create(:create_type)
5
+ FactoryBot.create(:create_type)
6
6
  end
7
7
  end
8
8
 
@@ -83,5 +83,5 @@ end
83
83
  # binding_item_identifier :string
84
84
  # binding_call_number :string
85
85
  # binded_at :datetime
86
- # manifestation_id :integer
86
+ # manifestation_id :integer not null
87
87
  #
@@ -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 = FactoryGirl.create(:manifestation, :pub_date => '2000')
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 = FactoryGirl.create(:manifestation, :pub_date => '2000-01')
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 = FactoryGirl.create(:manifestation, :volume_number_string => '第1巻', :issue_number_string => '20号分冊1', :edition_string => '第3版')
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 = FactoryGirl.create(:manifestation, edition: 2, edition_string: "Revised Ed.")
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 = FactoryGirl.create(:manifestation, title_transcription: "Transcripted title")
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
- FactoryGirl.create(:item, bookstore_id: 1, price: 100, budget_type_id: 1)
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)
@@ -2,7 +2,7 @@ require 'rails_helper'
2
2
 
3
3
  describe ProduceType do
4
4
  it 'should create produce_type' do
5
- FactoryGirl.create(:produce_type)
5
+ FactoryBot.create(:produce_type)
6
6
  end
7
7
  end
8
8
 
@@ -2,7 +2,7 @@ require 'rails_helper'
2
2
 
3
3
  describe RealizeType do
4
4
  it 'should create realize_type' do
5
- FactoryGirl.create(:realize_type)
5
+ FactoryBot.create(:realize_type)
6
6
  end
7
7
  end
8
8