enju_event 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/app/controllers/concerns/enju_event/enju_libraries_controller.rb +17 -0
  4. data/app/controllers/event_categories_controller.rb +1 -1
  5. data/app/controllers/event_export_files_controller.rb +1 -1
  6. data/app/controllers/event_import_files_controller.rb +3 -2
  7. data/app/controllers/event_import_results_controller.rb +2 -2
  8. data/app/controllers/events_controller.rb +7 -1
  9. data/app/controllers/participates_controller.rb +1 -1
  10. data/app/jobs/event_export_file_job.rb +1 -1
  11. data/app/jobs/event_import_file_job.rb +1 -1
  12. data/app/mailers/event_export_mailer.rb +17 -0
  13. data/app/mailers/event_import_mailer.rb +17 -0
  14. data/app/models/concerns/enju_event/enju_library.rb +15 -0
  15. data/app/models/event.rb +37 -24
  16. data/app/models/event_category.rb +1 -1
  17. data/app/models/event_export_file.rb +15 -10
  18. data/app/models/event_export_file_transition.rb +1 -1
  19. data/app/models/event_import_file.rb +13 -3
  20. data/app/models/event_import_file_transition.rb +1 -1
  21. data/app/models/event_import_result.rb +1 -2
  22. data/app/models/participate.rb +1 -1
  23. data/app/models/place.rb +1 -1
  24. data/app/views/event_export_mailer/completed.en.text.erb +9 -0
  25. data/app/views/event_export_mailer/completed.ja.text.erb +9 -0
  26. data/app/views/event_export_mailer/failed.en.text.erb +9 -0
  27. data/app/views/event_export_mailer/failed.ja.text.erb +9 -0
  28. data/app/views/event_import_files/_results.html.erb +26 -0
  29. data/app/views/event_import_files/show.html.erb +70 -74
  30. data/app/views/event_import_mailer/completed.en.text.erb +9 -0
  31. data/app/views/event_import_mailer/completed.ja.text.erb +9 -0
  32. data/app/views/event_import_mailer/failed.en.text.erb +9 -0
  33. data/app/views/event_import_mailer/failed.ja.text.erb +9 -0
  34. data/app/views/event_import_results/index.html.erb +0 -11
  35. data/app/views/events/index.html.erb +22 -22
  36. data/app/views/events/index.txt.ruby +7 -0
  37. data/app/views/layouts/mailer.html.erb +13 -0
  38. data/app/views/layouts/mailer.text.erb +1 -0
  39. data/config/locales/translation_en.yml +12 -0
  40. data/config/locales/translation_ja.yml +12 -0
  41. data/lib/enju_event/version.rb +1 -1
  42. data/spec/controllers/event_import_files_controller_spec.rb +2 -2
  43. data/spec/controllers/event_import_results_controller_spec.rb +2 -2
  44. data/spec/controllers/libraries_controller_spec.rb +41 -0
  45. data/spec/dummy/app/assets/config/manifest.js +5 -0
  46. data/spec/dummy/app/jobs/application_job.rb +7 -0
  47. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  48. data/spec/dummy/app/models/application_record.rb +3 -0
  49. data/spec/dummy/app/models/user.rb +1 -1
  50. data/spec/dummy/config/application.rb +1 -1
  51. data/spec/dummy/config/initializers/assets.rb +1 -0
  52. data/spec/dummy/config/storage.yml +34 -0
  53. data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +2 -4
  54. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +4 -5
  55. data/spec/dummy/db/migrate/20150421023923_create_identities.rb +14 -0
  56. data/spec/dummy/db/migrate/20151126005552_add_provider_to_identity.rb +5 -0
  57. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -8
  58. data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +11 -0
  59. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +11 -0
  60. data/spec/dummy/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
  61. data/spec/dummy/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
  62. data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
  63. data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
  64. data/spec/dummy/db/migrate/20181026064038_add_login_banner_to_library_group.rb +6 -0
  65. data/spec/dummy/db/migrate/20181030072731_add_not_null_to_position_on_carrier_type.rb +14 -0
  66. data/spec/dummy/db/migrate/20181030074920_add_not_null_to_position_on_library.rb +14 -0
  67. data/spec/dummy/db/migrate/20190208135957_create_active_storage_tables.active_storage.rb +27 -0
  68. data/spec/dummy/db/migrate/20190311154610_create_periodicals.rb +10 -0
  69. data/spec/dummy/db/migrate/20190314151124_add_full_name_translations_to_create.rb +7 -0
  70. data/spec/dummy/db/schema.rb +114 -25
  71. data/spec/factories/event_export_file.rb +5 -0
  72. data/spec/factories/event_import_file.rb +7 -0
  73. data/spec/factories/event_import_result.rb +6 -0
  74. data/spec/mailers/event_export_spec.rb +5 -0
  75. data/spec/mailers/event_import_spec.rb +5 -0
  76. data/spec/mailers/previews/event_export_preview.rb +4 -0
  77. data/spec/mailers/previews/event_import_preview.rb +4 -0
  78. data/spec/models/event_export_file_spec.rb +1 -1
  79. data/spec/models/event_import_file_spec.rb +1 -1
  80. data/spec/rails_helper.rb +6 -0
  81. data/spec/system/event_import_results_spec.rb +17 -0
  82. data/spec/system/events_spec.rb +22 -0
  83. data/spec/views/events/index.json.jbuilder_spec.rb +22 -0
  84. metadata +153 -9
  85. data/README.rdoc +0 -10
  86. data/spec/support/resque.rb +0 -32
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20181119170645) do
13
+ ActiveRecord::Schema.define(version: 2019_03_14_151124) do
14
14
 
15
15
  create_table "accepts", force: :cascade do |t|
16
16
  t.integer "basket_id"
@@ -23,6 +23,27 @@ ActiveRecord::Schema.define(version: 20181119170645) do
23
23
  t.index ["librarian_id"], name: "index_accepts_on_librarian_id"
24
24
  end
25
25
 
26
+ create_table "active_storage_attachments", force: :cascade do |t|
27
+ t.string "name", null: false
28
+ t.string "record_type", null: false
29
+ t.integer "record_id", null: false
30
+ t.integer "blob_id", null: false
31
+ t.datetime "created_at", null: false
32
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
33
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
34
+ end
35
+
36
+ create_table "active_storage_blobs", force: :cascade do |t|
37
+ t.string "key", null: false
38
+ t.string "filename", null: false
39
+ t.string "content_type"
40
+ t.text "metadata"
41
+ t.bigint "byte_size", null: false
42
+ t.string "checksum", null: false
43
+ t.datetime "created_at", null: false
44
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
45
+ end
46
+
26
47
  create_table "agent_import_file_transitions", force: :cascade do |t|
27
48
  t.string "to_state"
28
49
  t.text "metadata", default: "{}"
@@ -104,7 +125,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
104
125
  t.string "name", null: false
105
126
  t.text "display_name"
106
127
  t.text "note"
107
- t.integer "position"
128
+ t.integer "position", default: 1, null: false
108
129
  t.datetime "created_at"
109
130
  t.datetime "updated_at"
110
131
  end
@@ -181,7 +202,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
181
202
  t.string "telephone_number"
182
203
  t.string "fax_number"
183
204
  t.string "url"
184
- t.integer "position"
205
+ t.integer "position", default: 1, null: false
185
206
  t.datetime "deleted_at"
186
207
  t.datetime "created_at"
187
208
  t.datetime "updated_at"
@@ -191,7 +212,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
191
212
  t.string "name"
192
213
  t.text "display_name"
193
214
  t.text "note"
194
- t.integer "position"
215
+ t.integer "position", default: 1, null: false
195
216
  t.datetime "created_at"
196
217
  t.datetime "updated_at"
197
218
  end
@@ -211,7 +232,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
211
232
  t.string "name", null: false
212
233
  t.text "display_name"
213
234
  t.text "note"
214
- t.integer "position"
235
+ t.integer "position", default: 1, null: false
215
236
  t.datetime "created_at"
216
237
  t.datetime "updated_at"
217
238
  t.string "attachment_file_name"
@@ -307,7 +328,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
307
328
  t.integer "library_group_id"
308
329
  t.string "property"
309
330
  t.string "code"
310
- t.integer "position"
331
+ t.integer "position", default: 1, null: false
311
332
  t.datetime "created_at"
312
333
  t.datetime "updated_at"
313
334
  t.index ["library_group_id"], name: "index_colors_on_library_group_id"
@@ -317,7 +338,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
317
338
  t.string "name", null: false
318
339
  t.text "display_name"
319
340
  t.text "note"
320
- t.integer "position"
341
+ t.integer "position", default: 1, null: false
321
342
  t.datetime "created_at"
322
343
  t.datetime "updated_at"
323
344
  end
@@ -348,10 +369,11 @@ ActiveRecord::Schema.define(version: 20181119170645) do
348
369
  create_table "creates", force: :cascade do |t|
349
370
  t.integer "agent_id", null: false
350
371
  t.integer "work_id", null: false
351
- t.integer "position"
372
+ t.integer "position", default: 1, null: false
352
373
  t.datetime "created_at"
353
374
  t.datetime "updated_at"
354
375
  t.integer "create_type_id"
376
+ t.json "full_name_translations", default: {}
355
377
  t.index ["agent_id"], name: "index_creates_on_agent_id"
356
378
  t.index ["work_id"], name: "index_creates_on_work_id"
357
379
  end
@@ -475,7 +497,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
475
497
  t.string "name", null: false
476
498
  t.text "display_name"
477
499
  t.text "note"
478
- t.integer "position"
500
+ t.integer "position", default: 1, null: false
479
501
  t.datetime "created_at"
480
502
  t.datetime "updated_at"
481
503
  end
@@ -484,7 +506,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
484
506
  t.string "name", null: false
485
507
  t.text "display_name"
486
508
  t.text "note"
487
- t.integer "position"
509
+ t.integer "position", default: 1, null: false
488
510
  t.datetime "created_at"
489
511
  t.datetime "updated_at"
490
512
  end
@@ -510,6 +532,19 @@ ActiveRecord::Schema.define(version: 20181119170645) do
510
532
  t.index ["manifestation_id"], name: "index_identifiers_on_manifestation_id"
511
533
  end
512
534
 
535
+ create_table "identities", force: :cascade do |t|
536
+ t.string "name"
537
+ t.string "email"
538
+ t.string "password_digest"
539
+ t.integer "profile_id"
540
+ t.datetime "created_at", null: false
541
+ t.datetime "updated_at", null: false
542
+ t.string "provider"
543
+ t.index ["email"], name: "index_identities_on_email"
544
+ t.index ["name"], name: "index_identities_on_name"
545
+ t.index ["profile_id"], name: "index_identities_on_profile_id"
546
+ end
547
+
513
548
  create_table "import_request_transitions", force: :cascade do |t|
514
549
  t.string "to_state"
515
550
  t.text "metadata", default: "{}"
@@ -534,6 +569,44 @@ ActiveRecord::Schema.define(version: 20181119170645) do
534
569
  t.index ["user_id"], name: "index_import_requests_on_user_id"
535
570
  end
536
571
 
572
+ create_table "isbn_record_and_manifestations", force: :cascade do |t|
573
+ t.integer "isbn_record_id", null: false
574
+ t.integer "manifestation_id", null: false
575
+ t.integer "position"
576
+ t.datetime "created_at", null: false
577
+ t.datetime "updated_at", null: false
578
+ t.index ["isbn_record_id"], name: "index_isbn_record_and_manifestations_on_isbn_record_id"
579
+ t.index ["manifestation_id"], name: "index_isbn_record_and_manifestations_on_manifestation_id"
580
+ end
581
+
582
+ create_table "isbn_records", force: :cascade do |t|
583
+ t.string "body", null: false
584
+ t.string "isbn_type"
585
+ t.string "source"
586
+ t.datetime "created_at", null: false
587
+ t.datetime "updated_at", null: false
588
+ t.index ["body"], name: "index_isbn_records_on_body", unique: true
589
+ end
590
+
591
+ create_table "issn_record_and_manifestations", force: :cascade do |t|
592
+ t.integer "issn_record_id", null: false
593
+ t.integer "manifestation_id", null: false
594
+ t.integer "position"
595
+ t.datetime "created_at", null: false
596
+ t.datetime "updated_at", null: false
597
+ t.index ["issn_record_id"], name: "index_issn_record_and_manifestations_on_issn_record_id"
598
+ t.index ["manifestation_id"], name: "index_issn_record_and_manifestations_on_manifestation_id"
599
+ end
600
+
601
+ create_table "issn_records", force: :cascade do |t|
602
+ t.string "body", null: false
603
+ t.string "issn_type"
604
+ t.string "source"
605
+ t.datetime "created_at", null: false
606
+ t.datetime "updated_at", null: false
607
+ t.index ["body"], name: "index_issn_records_on_body", unique: true
608
+ end
609
+
537
610
  create_table "item_has_use_restrictions", force: :cascade do |t|
538
611
  t.integer "item_id", null: false
539
612
  t.integer "use_restriction_id", null: false
@@ -621,7 +694,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
621
694
  t.string "call_number_delimiter", default: "|", null: false
622
695
  t.integer "library_group_id", null: false
623
696
  t.integer "users_count", default: 0, null: false
624
- t.integer "position"
697
+ t.integer "position", default: 1, null: false
625
698
  t.integer "country_id"
626
699
  t.datetime "created_at"
627
700
  t.datetime "updated_at"
@@ -653,7 +726,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
653
726
  t.text "old_login_banner"
654
727
  t.text "note"
655
728
  t.integer "country_id"
656
- t.integer "position"
729
+ t.integer "position", default: 1, null: false
657
730
  t.datetime "created_at"
658
731
  t.datetime "updated_at"
659
732
  t.text "admin_networks"
@@ -670,6 +743,8 @@ ActiveRecord::Schema.define(version: 20181119170645) do
670
743
  t.integer "header_logo_file_size"
671
744
  t.datetime "header_logo_updated_at"
672
745
  t.text "header_logo_meta"
746
+ t.json "login_banner_translations", default: "\"{}\"", null: false
747
+ t.json "footer_banner_translations", default: "\"{}\"", null: false
673
748
  t.index ["short_name"], name: "index_library_groups_on_short_name"
674
749
  t.index ["user_id"], name: "index_library_groups_on_user_id"
675
750
  end
@@ -678,7 +753,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
678
753
  t.string "name", null: false
679
754
  t.string "display_name"
680
755
  t.text "note"
681
- t.integer "position"
756
+ t.integer "position", default: 1, null: false
682
757
  t.datetime "created_at"
683
758
  t.datetime "updated_at"
684
759
  end
@@ -832,7 +907,8 @@ ActiveRecord::Schema.define(version: 20181119170645) do
832
907
  t.integer "message_request_id"
833
908
  t.datetime "created_at"
834
909
  t.datetime "updated_at"
835
- t.boolean "most_recent"
910
+ t.boolean "most_recent", null: false
911
+ t.index ["message_request_id", "most_recent"], name: "index_message_request_transitions_parent_most_recent", unique: true, where: "most_recent"
836
912
  t.index ["message_request_id"], name: "index_message_request_transitions_on_message_request_id"
837
913
  t.index ["sort_key", "message_request_id"], name: "index_message_request_transitions_on_sort_key_and_request_id", unique: true
838
914
  end
@@ -866,7 +942,8 @@ ActiveRecord::Schema.define(version: 20181119170645) do
866
942
  t.integer "message_id"
867
943
  t.datetime "created_at"
868
944
  t.datetime "updated_at"
869
- t.boolean "most_recent"
945
+ t.boolean "most_recent", null: false
946
+ t.index ["message_id", "most_recent"], name: "index_message_transitions_parent_most_recent", unique: true, where: "most_recent"
870
947
  t.index ["message_id"], name: "index_message_transitions_on_message_id"
871
948
  t.index ["sort_key", "message_id"], name: "index_message_transitions_on_sort_key_and_message_id", unique: true
872
949
  end
@@ -893,7 +970,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
893
970
  create_table "owns", force: :cascade do |t|
894
971
  t.integer "agent_id", null: false
895
972
  t.integer "item_id", null: false
896
- t.integer "position"
973
+ t.integer "position", default: 1, null: false
897
974
  t.datetime "created_at"
898
975
  t.datetime "updated_at"
899
976
  t.index ["agent_id"], name: "index_owns_on_agent_id"
@@ -910,6 +987,14 @@ ActiveRecord::Schema.define(version: 20181119170645) do
910
987
  t.index ["event_id"], name: "index_participates_on_event_id"
911
988
  end
912
989
 
990
+ create_table "periodicals", force: :cascade do |t|
991
+ t.text "original_title", null: false
992
+ t.integer "frequency_id", null: false
993
+ t.datetime "created_at", null: false
994
+ t.datetime "updated_at", null: false
995
+ t.index ["frequency_id"], name: "index_periodicals_on_frequency_id"
996
+ end
997
+
913
998
  create_table "picture_files", force: :cascade do |t|
914
999
  t.integer "picture_attachable_id"
915
1000
  t.string "picture_attachable_type"
@@ -954,10 +1039,11 @@ ActiveRecord::Schema.define(version: 20181119170645) do
954
1039
  create_table "produces", force: :cascade do |t|
955
1040
  t.integer "agent_id", null: false
956
1041
  t.integer "manifestation_id", null: false
957
- t.integer "position"
1042
+ t.integer "position", default: 1, null: false
958
1043
  t.datetime "created_at"
959
1044
  t.datetime "updated_at"
960
1045
  t.integer "produce_type_id"
1046
+ t.json "full_name_translations", default: {}
961
1047
  t.index ["agent_id"], name: "index_produces_on_agent_id"
962
1048
  t.index ["manifestation_id"], name: "index_produces_on_manifestation_id"
963
1049
  end
@@ -980,6 +1066,8 @@ ActiveRecord::Schema.define(version: 20181119170645) do
980
1066
  t.text "full_name_transcription"
981
1067
  t.datetime "date_of_birth"
982
1068
  t.index ["checkout_icalendar_token"], name: "index_profiles_on_checkout_icalendar_token", unique: true
1069
+ t.index ["library_id"], name: "index_profiles_on_library_id"
1070
+ t.index ["user_group_id"], name: "index_profiles_on_user_group_id"
983
1071
  t.index ["user_id"], name: "index_profiles_on_user_id"
984
1072
  t.index ["user_number"], name: "index_profiles_on_user_number", unique: true
985
1073
  end
@@ -996,10 +1084,11 @@ ActiveRecord::Schema.define(version: 20181119170645) do
996
1084
  create_table "realizes", force: :cascade do |t|
997
1085
  t.integer "agent_id", null: false
998
1086
  t.integer "expression_id", null: false
999
- t.integer "position"
1087
+ t.integer "position", default: 1, null: false
1000
1088
  t.datetime "created_at"
1001
1089
  t.datetime "updated_at"
1002
1090
  t.integer "realize_type_id"
1091
+ t.json "full_name_translations", default: {}
1003
1092
  t.index ["agent_id"], name: "index_realizes_on_agent_id"
1004
1093
  t.index ["expression_id"], name: "index_realizes_on_expression_id"
1005
1094
  end
@@ -1008,7 +1097,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
1008
1097
  t.string "name", null: false
1009
1098
  t.text "display_name"
1010
1099
  t.text "note"
1011
- t.integer "position"
1100
+ t.integer "position", default: 1, null: false
1012
1101
  t.datetime "created_at"
1013
1102
  t.datetime "updated_at"
1014
1103
  end
@@ -1017,7 +1106,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
1017
1106
  t.string "name", null: false
1018
1107
  t.text "display_name"
1019
1108
  t.text "note"
1020
- t.integer "position"
1109
+ t.integer "position", default: 1, null: false
1021
1110
  t.datetime "created_at"
1022
1111
  t.datetime "updated_at"
1023
1112
  end
@@ -1166,7 +1255,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
1166
1255
  t.text "query_param", null: false
1167
1256
  t.text "additional_param"
1168
1257
  t.text "note"
1169
- t.integer "position"
1258
+ t.integer "position", default: 1, null: false
1170
1259
  t.datetime "created_at"
1171
1260
  t.datetime "updated_at"
1172
1261
  end
@@ -1216,7 +1305,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
1216
1305
  t.text "note"
1217
1306
  t.integer "library_id", null: false
1218
1307
  t.integer "items_count", default: 0, null: false
1219
- t.integer "position"
1308
+ t.integer "position", default: 1, null: false
1220
1309
  t.datetime "created_at"
1221
1310
  t.datetime "updated_at"
1222
1311
  t.datetime "deleted_at"
@@ -1329,7 +1418,7 @@ ActiveRecord::Schema.define(version: 20181119170645) do
1329
1418
  t.string "name"
1330
1419
  t.text "display_name"
1331
1420
  t.text "note"
1332
- t.integer "position"
1421
+ t.integer "position", default: 1, null: false
1333
1422
  t.datetime "created_at"
1334
1423
  t.datetime "updated_at"
1335
1424
  t.datetime "deleted_at"
@@ -1341,8 +1430,8 @@ ActiveRecord::Schema.define(version: 20181119170645) do
1341
1430
  end
1342
1431
 
1343
1432
  create_table "user_has_roles", force: :cascade do |t|
1344
- t.integer "user_id"
1345
- t.integer "role_id"
1433
+ t.integer "user_id", null: false
1434
+ t.integer "role_id", null: false
1346
1435
  t.datetime "created_at"
1347
1436
  t.datetime "updated_at"
1348
1437
  t.index ["role_id"], name: "index_user_has_roles_on_role_id"
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :event_export_file, class: EventExportFile do
3
+ association :user
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :event_import_file, class: EventImportFile do
3
+ association :user
4
+ association :default_library, factory: :library
5
+ default_event_category_id { EventCategory.first.id }
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :event_import_result, class: EventImportResult do
3
+ association :event_import_file
4
+ association :event
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.describe EventExportMailer, type: :mailer do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
@@ -0,0 +1,5 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.describe EventImportMailer, type: :mailer do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
@@ -0,0 +1,4 @@
1
+ # Preview all emails at http://localhost:3000/rails/mailers/event_export
2
+ class EventExportPreview < ActionMailer::Preview
3
+
4
+ end
@@ -0,0 +1,4 @@
1
+ # Preview all emails at http://localhost:3000/rails/mailers/event_import
2
+ class EventImportPreview < ActionMailer::Preview
3
+
4
+ end
@@ -10,7 +10,7 @@ describe EventExportFile do
10
10
  file.save
11
11
  EventExportFileJob.perform_later(file).should be_truthy
12
12
  Message.count.should eq message_count + 1
13
- Message.order(:id).last.subject.should eq 'エクスポートが完了しました'
13
+ Message.order(:created_at).last.subject.should eq "Export completed: #{file.id}"
14
14
  end
15
15
  end
16
16
 
@@ -43,7 +43,7 @@ describe EventImportFile do
43
43
  @file.user = User.where(username: 'librarian1').first
44
44
  @file.import_start
45
45
  Message.count.should eq old_message_count + 1
46
- Message.order(:id).last.subject.should eq 'インポートが完了しました'
46
+ Message.order(:created_at).last.subject.should eq "Import completed: #{@file.id}"
47
47
  end
48
48
  end
49
49
 
data/spec/rails_helper.rb CHANGED
@@ -59,6 +59,12 @@ RSpec.configure do |config|
59
59
  config.infer_spec_type_from_file_location!
60
60
 
61
61
  config.extend ControllerMacros, type: :controller
62
+
63
+ config.before(:each) do |example|
64
+ if example.metadata[:type] == :system
65
+ driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
66
+ end
67
+ end
62
68
  end
63
69
 
64
70
  FactoryBot.definition_file_paths << "#{::Rails.root}/../../spec/factories"
@@ -0,0 +1,17 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe 'EventImportResults', type: :system do
4
+ include Devise::Test::IntegrationHelpers
5
+ fixtures :all
6
+
7
+ describe 'When logged in as Administrator' do
8
+ before do
9
+ sign_in users(:admin)
10
+ end
11
+
12
+ it 'should get event_import_results index' do
13
+ visit event_import_results_path
14
+ expect(page).not_to have_link 'TSV'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe 'Events', type: :system do
4
+ include Devise::Test::IntegrationHelpers
5
+ fixtures :all
6
+
7
+ describe 'When not logged in', solr: true do
8
+ before(:each) do
9
+ Event.reindex
10
+ end
11
+
12
+ it 'should contain query params in the facet' do
13
+ visit events_path(query: 'test')
14
+ expect(page).to have_link 'Kamata Library', href: events_path(library_id: 'kamata', query: 'test')
15
+ end
16
+
17
+ it 'should export events in txt format' do
18
+ visit events_path(format: :txt)
19
+ expect(page).to have_content 'Kamata Library'
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ require 'rails_helper'
2
+
3
+ describe "events/index.json.jbuilder" do
4
+ fixtures :all
5
+
6
+ before(:each) do
7
+ 20.times do |c|
8
+ FactoryBot.create(:event)
9
+ end
10
+ assign(:events, Event.page(1))
11
+ end
12
+
13
+ it "renders a list of events" do
14
+ render
15
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
16
+ expect(response.body).to match /\A\[/
17
+ data = JSON.parse(response.body)
18
+ expect(data.first).not_to be_nil
19
+ expect(data.first).to have_key("start")
20
+ expect(data.first).to have_key("url")
21
+ end
22
+ end