enju_seed 0.3.2 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/Rakefile +1 -1
  4. data/app/controllers/profiles_controller.rb +3 -3
  5. data/app/controllers/roles_controller.rb +1 -1
  6. data/app/models/concerns/enju_seed/enju_user.rb +7 -7
  7. data/app/models/identity.rb +1 -1
  8. data/app/models/profile.rb +2 -2
  9. data/app/models/role.rb +2 -2
  10. data/app/models/user_has_role.rb +1 -4
  11. data/app/views/roles/_form.html.erb +1 -1
  12. data/app/views/roles/show.html.erb +0 -5
  13. data/lib/enju_seed/version.rb +1 -1
  14. data/lib/generators/enju_seed/setup/setup_generator.rb +9 -0
  15. data/lib/generators/enju_seed/setup/templates/db/fixtures/roles.yml +38 -0
  16. data/lib/tasks/enju_seed_tasks.rake +8 -4
  17. data/spec/controllers/profiles_controller_spec.rb +8 -0
  18. data/spec/dummy/app/models/application_record.rb +3 -0
  19. data/spec/dummy/app/models/user.rb +1 -1
  20. data/spec/dummy/config/application.rb +1 -1
  21. data/spec/dummy/config/webpack/development.js +5 -0
  22. data/spec/dummy/config/webpack/environment.js +11 -0
  23. data/spec/dummy/config/webpack/production.js +5 -0
  24. data/spec/dummy/config/webpack/test.js +5 -0
  25. data/spec/dummy/config/webpacker.yml +95 -0
  26. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -8
  27. data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +11 -0
  28. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +11 -0
  29. data/spec/dummy/db/migrate/20160801080612_add_most_recent_to_import_request_transitions.rb +9 -0
  30. data/spec/dummy/db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb +9 -0
  31. data/spec/dummy/db/migrate/20160801080637_add_most_recent_to_resource_export_file_transitions.rb +9 -0
  32. data/spec/dummy/db/migrate/20160801080643_add_most_recent_to_agent_import_file_transitions.rb +9 -0
  33. data/spec/dummy/db/migrate/20160811102604_add_picture_width_to_picture_file.rb +6 -0
  34. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
  35. data/spec/dummy/db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb +11 -0
  36. data/spec/dummy/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
  37. data/spec/dummy/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
  38. data/spec/dummy/db/migrate/20171119051258_set_not_null_to_manifestation_id_on_items.rb +5 -0
  39. data/spec/dummy/db/migrate/20180107160726_add_constraints_to_most_recent_for_user_import_file_transitions.rb +13 -0
  40. data/spec/dummy/db/migrate/20180107160740_add_constraints_to_most_recent_for_user_export_file_transitions.rb +13 -0
  41. data/spec/dummy/db/migrate/20180107161311_add_constraints_to_most_recent_for_agent_import_file_transitions.rb +13 -0
  42. data/spec/dummy/db/migrate/20180107161331_add_constraints_to_most_recent_for_resource_import_file_transitions.rb +13 -0
  43. data/spec/dummy/db/migrate/20180107161347_add_constraints_to_most_recent_for_resource_export_file_transitions.rb +13 -0
  44. data/spec/dummy/db/migrate/20180107161410_add_constraints_to_most_recent_for_import_request_transitions.rb +13 -0
  45. data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
  46. data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
  47. data/spec/dummy/db/migrate/20181026064038_add_login_banner_to_library_group.rb +6 -0
  48. data/spec/dummy/db/migrate/20181030072731_add_not_null_to_position_on_carrier_type.rb +14 -0
  49. data/spec/dummy/db/migrate/20181030074920_add_not_null_to_position_on_library.rb +14 -0
  50. data/spec/dummy/db/migrate/20190208135957_create_active_storage_tables.active_storage.rb +27 -0
  51. data/spec/dummy/db/migrate/20190311154610_create_periodicals.rb +10 -0
  52. data/spec/dummy/db/migrate/20190314151124_add_full_name_translations_to_create.rb +7 -0
  53. data/spec/dummy/db/schema.rb +116 -25
  54. data/spec/models/user_has_role_spec.rb +0 -1
  55. data/spec/views/profiles/show.html.erb_spec.rb +1 -1
  56. data/spec/views/roles/edit.html.erb_spec.rb +18 -0
  57. data/spec/views/roles/index.html.erb_spec.rb +14 -0
  58. data/spec/views/roles/new.html.erb_spec.rb +18 -0
  59. data/spec/views/roles/show.html.erb_spec.rb +14 -0
  60. metadata +388 -258
  61. data/README.rdoc +0 -3
@@ -0,0 +1,13 @@
1
+ class AddConstraintsToMostRecentForResourceExportFileTransitions < ActiveRecord::Migration[4.2]
2
+ disable_ddl_transaction!
3
+
4
+ def up
5
+ add_index :resource_export_file_transitions, [:resource_export_file_id, :most_recent], unique: true, where: "most_recent", name: "index_resource_export_file_transitions_parent_most_recent" #, algorithm: :concurrently
6
+ change_column_null :resource_export_file_transitions, :most_recent, false
7
+ end
8
+
9
+ def down
10
+ remove_index :resource_export_file_transitions, name: "index_resource_export_file_transitions_parent_most_recent"
11
+ change_column_null :resource_export_file_transitions, :most_recent, true
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class AddConstraintsToMostRecentForImportRequestTransitions < ActiveRecord::Migration[4.2]
2
+ disable_ddl_transaction!
3
+
4
+ def up
5
+ add_index :import_request_transitions, [:import_request_id, :most_recent], unique: true, where: "most_recent", name: "index_import_request_transitions_parent_most_recent" #, algorithm: :concurrently
6
+ change_column_null :import_request_transitions, :most_recent, false
7
+ end
8
+
9
+ def down
10
+ remove_index :import_request_transitions, name: "index_import_request_transitions_parent_most_recent"
11
+ change_column_null :import_request_transitions, :most_recent, true
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class AddConstraintsToMostRecentForMessageTransitions < ActiveRecord::Migration[5.2]
2
+ disable_ddl_transaction!
3
+
4
+ def up
5
+ add_index :message_transitions, [:message_id, :most_recent], unique: true, where: "most_recent", name: "index_message_transitions_parent_most_recent" # , algorithm: :concurrently
6
+ change_column_null :message_transitions, :most_recent, false
7
+ end
8
+
9
+ def down
10
+ remove_index :message_transitions, name: "index_message_transitions_parent_most_recent"
11
+ change_column_null :message_transitions, :most_recent, true
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class AddConstraintsToMostRecentForMessageRequestTransitions < ActiveRecord::Migration[5.2]
2
+ disable_ddl_transaction!
3
+
4
+ def up
5
+ add_index :message_request_transitions, [:message_request_id, :most_recent], unique: true, where: "most_recent", name: "index_message_request_transitions_parent_most_recent" # , algorithm: :concurrently
6
+ change_column_null :message_request_transitions, :most_recent, false
7
+ end
8
+
9
+ def down
10
+ remove_index :message_request_transitions, name: "index_message_request_transitions_parent_most_recent"
11
+ change_column_null :message_request_transitions, :most_recent, true
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ class AddLoginBannerToLibraryGroup < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :library_groups, :login_banner_translations, :jsonb, default: {}, null: false
4
+ add_column :library_groups, :footer_banner_translations, :jsonb, default: {}, null: false
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ class AddNotNullToPositionOnCarrierType < ActiveRecord::Migration[5.2]
2
+ def change
3
+ change_column :carrier_types, :position, :integer, null: false, default: 1
4
+ change_column :content_types, :position, :integer, null: false, default: 1
5
+ change_column :frequencies, :position, :integer, null: false, default: 1
6
+ change_column :licenses, :position, :integer, null: false, default: 1
7
+ change_column :creates, :position, :integer, null: false, default: 1
8
+ change_column :realizes, :position, :integer, null: false, default: 1
9
+ change_column :produces, :position, :integer, null: false, default: 1
10
+ change_column :owns, :position, :integer, null: false, default: 1
11
+ change_column :form_of_works, :position, :integer, null: false, default: 1
12
+ change_column :agent_types, :position, :integer, null: false, default: 1
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ class AddNotNullToPositionOnLibrary < ActiveRecord::Migration[5.2]
2
+ def change
3
+ change_column :libraries, :position, :integer, null: false, default: 1
4
+ change_column :shelves, :position, :integer, null: false, default: 1
5
+ change_column :library_groups, :position, :integer, null: false, default: 1
6
+ change_column :user_groups, :position, :integer, null: false, default: 1
7
+ change_column :bookstores, :position, :integer, null: false, default: 1
8
+ change_column :budget_types, :position, :integer, null: false, default: 1
9
+ change_column :colors, :position, :integer, null: false, default: 1
10
+ change_column :request_types, :position, :integer, null: false, default: 1
11
+ change_column :request_status_types, :position, :integer, null: false, default: 1
12
+ change_column :search_engines, :position, :integer, null: false, default: 1
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ # This migration comes from active_storage (originally 20170806125915)
2
+ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
3
+ def change
4
+ create_table :active_storage_blobs do |t|
5
+ t.string :key, null: false
6
+ t.string :filename, null: false
7
+ t.string :content_type
8
+ t.text :metadata
9
+ t.bigint :byte_size, null: false
10
+ t.string :checksum, null: false
11
+ t.datetime :created_at, null: false
12
+
13
+ t.index [ :key ], unique: true
14
+ end
15
+
16
+ create_table :active_storage_attachments do |t|
17
+ t.string :name, null: false
18
+ t.references :record, null: false, polymorphic: true, index: false
19
+ t.references :blob, null: false
20
+
21
+ t.datetime :created_at, null: false
22
+
23
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
24
+ t.foreign_key :active_storage_blobs, column: :blob_id
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePeriodicals < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :periodicals do |t|
4
+ t.text :original_title, null: false
5
+ t.references :frequency, foreign_key: true, null: false
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ class AddFullNameTranslationsToCreate < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :creates, :full_name_translations, :jsonb, default: {}
4
+ add_column :realizes, :full_name_translations, :jsonb, default: {}
5
+ add_column :produces, :full_name_translations, :jsonb, default: {}
6
+ end
7
+ end
@@ -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: 20180102162311) 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: 20180102162311) 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: "{}"
@@ -30,6 +51,8 @@ ActiveRecord::Schema.define(version: 20180102162311) do
30
51
  t.integer "agent_import_file_id"
31
52
  t.datetime "created_at"
32
53
  t.datetime "updated_at"
54
+ t.boolean "most_recent", null: false
55
+ t.index ["agent_import_file_id", "most_recent"], name: "index_agent_import_file_transitions_parent_most_recent", unique: true, where: "most_recent"
33
56
  t.index ["agent_import_file_id"], name: "index_agent_import_file_transitions_on_agent_import_file_id"
34
57
  t.index ["sort_key", "agent_import_file_id"], name: "index_agent_import_file_transitions_on_sort_key_and_file_id", unique: true
35
58
  end
@@ -102,7 +125,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
102
125
  t.string "name", null: false
103
126
  t.text "display_name"
104
127
  t.text "note"
105
- t.integer "position"
128
+ t.integer "position", default: 1, null: false
106
129
  t.datetime "created_at"
107
130
  t.datetime "updated_at"
108
131
  end
@@ -179,7 +202,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
179
202
  t.string "telephone_number"
180
203
  t.string "fax_number"
181
204
  t.string "url"
182
- t.integer "position"
205
+ t.integer "position", default: 1, null: false
183
206
  t.datetime "deleted_at"
184
207
  t.datetime "created_at"
185
208
  t.datetime "updated_at"
@@ -189,7 +212,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
189
212
  t.string "name"
190
213
  t.text "display_name"
191
214
  t.text "note"
192
- t.integer "position"
215
+ t.integer "position", default: 1, null: false
193
216
  t.datetime "created_at"
194
217
  t.datetime "updated_at"
195
218
  end
@@ -209,9 +232,13 @@ ActiveRecord::Schema.define(version: 20180102162311) do
209
232
  t.string "name", null: false
210
233
  t.text "display_name"
211
234
  t.text "note"
212
- t.integer "position"
235
+ t.integer "position", default: 1, null: false
213
236
  t.datetime "created_at"
214
237
  t.datetime "updated_at"
238
+ t.string "attachment_file_name"
239
+ t.string "attachment_content_type"
240
+ t.integer "attachment_file_size"
241
+ t.datetime "attachment_updated_at"
215
242
  end
216
243
 
217
244
  create_table "checked_items", force: :cascade do |t|
@@ -303,7 +330,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
303
330
  t.integer "library_group_id"
304
331
  t.string "property"
305
332
  t.string "code"
306
- t.integer "position"
333
+ t.integer "position", default: 1, null: false
307
334
  t.datetime "created_at"
308
335
  t.datetime "updated_at"
309
336
  t.index ["library_group_id"], name: "index_colors_on_library_group_id"
@@ -313,7 +340,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
313
340
  t.string "name", null: false
314
341
  t.text "display_name"
315
342
  t.text "note"
316
- t.integer "position"
343
+ t.integer "position", default: 1, null: false
317
344
  t.datetime "created_at"
318
345
  t.datetime "updated_at"
319
346
  end
@@ -344,10 +371,11 @@ ActiveRecord::Schema.define(version: 20180102162311) do
344
371
  create_table "creates", force: :cascade do |t|
345
372
  t.integer "agent_id", null: false
346
373
  t.integer "work_id", null: false
347
- t.integer "position"
374
+ t.integer "position", default: 1, null: false
348
375
  t.datetime "created_at"
349
376
  t.datetime "updated_at"
350
377
  t.integer "create_type_id"
378
+ t.json "full_name_translations", default: {}
351
379
  t.index ["agent_id"], name: "index_creates_on_agent_id"
352
380
  t.index ["work_id"], name: "index_creates_on_work_id"
353
381
  end
@@ -376,7 +404,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
376
404
  t.string "name", null: false
377
405
  t.text "display_name"
378
406
  t.text "note"
379
- t.integer "position"
407
+ t.integer "position", default: 1, null: false
380
408
  t.datetime "created_at"
381
409
  t.datetime "updated_at"
382
410
  end
@@ -385,7 +413,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
385
413
  t.string "name", null: false
386
414
  t.text "display_name"
387
415
  t.text "note"
388
- t.integer "position"
416
+ t.integer "position", default: 1, null: false
389
417
  t.datetime "created_at"
390
418
  t.datetime "updated_at"
391
419
  end
@@ -431,6 +459,8 @@ ActiveRecord::Schema.define(version: 20180102162311) do
431
459
  t.integer "import_request_id"
432
460
  t.datetime "created_at"
433
461
  t.datetime "updated_at"
462
+ t.boolean "most_recent", null: false
463
+ t.index ["import_request_id", "most_recent"], name: "index_import_request_transitions_parent_most_recent", unique: true, where: "most_recent"
434
464
  t.index ["import_request_id"], name: "index_import_request_transitions_on_import_request_id"
435
465
  t.index ["sort_key", "import_request_id"], name: "index_import_request_transitions_on_sort_key_and_request_id", unique: true
436
466
  end
@@ -446,6 +476,44 @@ ActiveRecord::Schema.define(version: 20180102162311) do
446
476
  t.index ["user_id"], name: "index_import_requests_on_user_id"
447
477
  end
448
478
 
479
+ create_table "isbn_record_and_manifestations", force: :cascade do |t|
480
+ t.integer "isbn_record_id", null: false
481
+ t.integer "manifestation_id", null: false
482
+ t.integer "position"
483
+ t.datetime "created_at", null: false
484
+ t.datetime "updated_at", null: false
485
+ t.index ["isbn_record_id"], name: "index_isbn_record_and_manifestations_on_isbn_record_id"
486
+ t.index ["manifestation_id"], name: "index_isbn_record_and_manifestations_on_manifestation_id"
487
+ end
488
+
489
+ create_table "isbn_records", force: :cascade do |t|
490
+ t.string "body", null: false
491
+ t.string "isbn_type"
492
+ t.string "source"
493
+ t.datetime "created_at", null: false
494
+ t.datetime "updated_at", null: false
495
+ t.index ["body"], name: "index_isbn_records_on_body", unique: true
496
+ end
497
+
498
+ create_table "issn_record_and_manifestations", force: :cascade do |t|
499
+ t.integer "issn_record_id", null: false
500
+ t.integer "manifestation_id", null: false
501
+ t.integer "position"
502
+ t.datetime "created_at", null: false
503
+ t.datetime "updated_at", null: false
504
+ t.index ["issn_record_id"], name: "index_issn_record_and_manifestations_on_issn_record_id"
505
+ t.index ["manifestation_id"], name: "index_issn_record_and_manifestations_on_manifestation_id"
506
+ end
507
+
508
+ create_table "issn_records", force: :cascade do |t|
509
+ t.string "body", null: false
510
+ t.string "issn_type"
511
+ t.string "source"
512
+ t.datetime "created_at", null: false
513
+ t.datetime "updated_at", null: false
514
+ t.index ["body"], name: "index_issn_records_on_body", unique: true
515
+ end
516
+
449
517
  create_table "item_has_use_restrictions", force: :cascade do |t|
450
518
  t.integer "item_id", null: false
451
519
  t.integer "use_restriction_id", null: false
@@ -477,7 +545,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
477
545
  t.string "binding_item_identifier"
478
546
  t.string "binding_call_number"
479
547
  t.datetime "binded_at"
480
- t.integer "manifestation_id"
548
+ t.integer "manifestation_id", null: false
481
549
  t.index ["binding_item_identifier"], name: "index_items_on_binding_item_identifier"
482
550
  t.index ["bookstore_id"], name: "index_items_on_bookstore_id"
483
551
  t.index ["checkout_type_id"], name: "index_items_on_checkout_type_id"
@@ -533,7 +601,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
533
601
  t.string "call_number_delimiter", default: "|", null: false
534
602
  t.integer "library_group_id", null: false
535
603
  t.integer "users_count", default: 0, null: false
536
- t.integer "position"
604
+ t.integer "position", default: 1, null: false
537
605
  t.integer "country_id"
538
606
  t.datetime "created_at"
539
607
  t.datetime "updated_at"
@@ -565,7 +633,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
565
633
  t.text "old_login_banner"
566
634
  t.text "note"
567
635
  t.integer "country_id"
568
- t.integer "position"
636
+ t.integer "position", default: 1, null: false
569
637
  t.datetime "created_at"
570
638
  t.datetime "updated_at"
571
639
  t.text "admin_networks"
@@ -582,6 +650,8 @@ ActiveRecord::Schema.define(version: 20180102162311) do
582
650
  t.integer "header_logo_file_size"
583
651
  t.datetime "header_logo_updated_at"
584
652
  t.text "header_logo_meta"
653
+ t.json "login_banner_translations", default: "\"{}\"", null: false
654
+ t.json "footer_banner_translations", default: "\"{}\"", null: false
585
655
  t.index ["short_name"], name: "index_library_groups_on_short_name"
586
656
  t.index ["user_id"], name: "index_library_groups_on_user_id"
587
657
  end
@@ -590,7 +660,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
590
660
  t.string "name", null: false
591
661
  t.string "display_name"
592
662
  t.text "note"
593
- t.integer "position"
663
+ t.integer "position", default: 1, null: false
594
664
  t.datetime "created_at"
595
665
  t.datetime "updated_at"
596
666
  end
@@ -744,6 +814,8 @@ ActiveRecord::Schema.define(version: 20180102162311) do
744
814
  t.integer "message_request_id"
745
815
  t.datetime "created_at"
746
816
  t.datetime "updated_at"
817
+ t.boolean "most_recent", null: false
818
+ t.index ["message_request_id", "most_recent"], name: "index_message_request_transitions_parent_most_recent", unique: true, where: "most_recent"
747
819
  t.index ["message_request_id"], name: "index_message_request_transitions_on_message_request_id"
748
820
  t.index ["sort_key", "message_request_id"], name: "index_message_request_transitions_on_sort_key_and_request_id", unique: true
749
821
  end
@@ -777,7 +849,8 @@ ActiveRecord::Schema.define(version: 20180102162311) do
777
849
  t.integer "message_id"
778
850
  t.datetime "created_at"
779
851
  t.datetime "updated_at"
780
- t.boolean "most_recent"
852
+ t.boolean "most_recent", null: false
853
+ t.index ["message_id", "most_recent"], name: "index_message_transitions_parent_most_recent", unique: true, where: "most_recent"
781
854
  t.index ["message_id"], name: "index_message_transitions_on_message_id"
782
855
  t.index ["sort_key", "message_id"], name: "index_message_transitions_on_sort_key_and_message_id", unique: true
783
856
  end
@@ -804,13 +877,21 @@ ActiveRecord::Schema.define(version: 20180102162311) do
804
877
  create_table "owns", force: :cascade do |t|
805
878
  t.integer "agent_id", null: false
806
879
  t.integer "item_id", null: false
807
- t.integer "position"
880
+ t.integer "position", default: 1, null: false
808
881
  t.datetime "created_at"
809
882
  t.datetime "updated_at"
810
883
  t.index ["agent_id"], name: "index_owns_on_agent_id"
811
884
  t.index ["item_id"], name: "index_owns_on_item_id"
812
885
  end
813
886
 
887
+ create_table "periodicals", force: :cascade do |t|
888
+ t.text "original_title", null: false
889
+ t.integer "frequency_id", null: false
890
+ t.datetime "created_at", null: false
891
+ t.datetime "updated_at", null: false
892
+ t.index ["frequency_id"], name: "index_periodicals_on_frequency_id"
893
+ end
894
+
814
895
  create_table "picture_files", force: :cascade do |t|
815
896
  t.integer "picture_attachable_id"
816
897
  t.string "picture_attachable_type"
@@ -826,6 +907,8 @@ ActiveRecord::Schema.define(version: 20180102162311) do
826
907
  t.datetime "picture_updated_at"
827
908
  t.text "picture_meta"
828
909
  t.string "picture_fingerprint"
910
+ t.integer "picture_width"
911
+ t.integer "picture_height"
829
912
  t.index ["picture_attachable_id", "picture_attachable_type"], name: "index_picture_files_on_picture_attachable_id_and_type"
830
913
  end
831
914
 
@@ -841,10 +924,11 @@ ActiveRecord::Schema.define(version: 20180102162311) do
841
924
  create_table "produces", force: :cascade do |t|
842
925
  t.integer "agent_id", null: false
843
926
  t.integer "manifestation_id", null: false
844
- t.integer "position"
927
+ t.integer "position", default: 1, null: false
845
928
  t.datetime "created_at"
846
929
  t.datetime "updated_at"
847
930
  t.integer "produce_type_id"
931
+ t.json "full_name_translations", default: {}
848
932
  t.index ["agent_id"], name: "index_produces_on_agent_id"
849
933
  t.index ["manifestation_id"], name: "index_produces_on_manifestation_id"
850
934
  end
@@ -885,10 +969,11 @@ ActiveRecord::Schema.define(version: 20180102162311) do
885
969
  create_table "realizes", force: :cascade do |t|
886
970
  t.integer "agent_id", null: false
887
971
  t.integer "expression_id", null: false
888
- t.integer "position"
972
+ t.integer "position", default: 1, null: false
889
973
  t.datetime "created_at"
890
974
  t.datetime "updated_at"
891
975
  t.integer "realize_type_id"
976
+ t.json "full_name_translations", default: {}
892
977
  t.index ["agent_id"], name: "index_realizes_on_agent_id"
893
978
  t.index ["expression_id"], name: "index_realizes_on_expression_id"
894
979
  end
@@ -897,7 +982,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
897
982
  t.string "name", null: false
898
983
  t.text "display_name"
899
984
  t.text "note"
900
- t.integer "position"
985
+ t.integer "position", default: 1, null: false
901
986
  t.datetime "created_at"
902
987
  t.datetime "updated_at"
903
988
  end
@@ -906,7 +991,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
906
991
  t.string "name", null: false
907
992
  t.text "display_name"
908
993
  t.text "note"
909
- t.integer "position"
994
+ t.integer "position", default: 1, null: false
910
995
  t.datetime "created_at"
911
996
  t.datetime "updated_at"
912
997
  end
@@ -974,6 +1059,8 @@ ActiveRecord::Schema.define(version: 20180102162311) do
974
1059
  t.integer "resource_export_file_id"
975
1060
  t.datetime "created_at"
976
1061
  t.datetime "updated_at"
1062
+ t.boolean "most_recent", null: false
1063
+ t.index ["resource_export_file_id", "most_recent"], name: "index_resource_export_file_transitions_parent_most_recent", unique: true, where: "most_recent"
977
1064
  t.index ["resource_export_file_id"], name: "index_resource_export_file_transitions_on_file_id"
978
1065
  t.index ["sort_key", "resource_export_file_id"], name: "index_resource_export_file_transitions_on_sort_key_and_file_id", unique: true
979
1066
  end
@@ -996,6 +1083,8 @@ ActiveRecord::Schema.define(version: 20180102162311) do
996
1083
  t.integer "resource_import_file_id"
997
1084
  t.datetime "created_at"
998
1085
  t.datetime "updated_at"
1086
+ t.boolean "most_recent", null: false
1087
+ t.index ["resource_import_file_id", "most_recent"], name: "index_resource_import_file_transitions_parent_most_recent", unique: true, where: "most_recent"
999
1088
  t.index ["resource_import_file_id"], name: "index_resource_import_file_transitions_on_file_id"
1000
1089
  t.index ["sort_key", "resource_import_file_id"], name: "index_resource_import_file_transitions_on_sort_key_and_file_id", unique: true
1001
1090
  end
@@ -1054,7 +1143,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
1054
1143
  t.text "query_param", null: false
1055
1144
  t.text "additional_param"
1056
1145
  t.text "note"
1057
- t.integer "position"
1146
+ t.integer "position", default: 1, null: false
1058
1147
  t.datetime "created_at"
1059
1148
  t.datetime "updated_at"
1060
1149
  end
@@ -1104,7 +1193,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
1104
1193
  t.text "note"
1105
1194
  t.integer "library_id", null: false
1106
1195
  t.integer "items_count", default: 0, null: false
1107
- t.integer "position"
1196
+ t.integer "position", default: 1, null: false
1108
1197
  t.datetime "created_at"
1109
1198
  t.datetime "updated_at"
1110
1199
  t.datetime "deleted_at"
@@ -1176,8 +1265,9 @@ ActiveRecord::Schema.define(version: 20180102162311) do
1176
1265
  t.integer "user_export_file_id"
1177
1266
  t.datetime "created_at"
1178
1267
  t.datetime "updated_at"
1179
- t.boolean "most_recent"
1268
+ t.boolean "most_recent", null: false
1180
1269
  t.index ["sort_key", "user_export_file_id"], name: "index_user_export_file_transitions_on_sort_key_and_file_id", unique: true
1270
+ t.index ["user_export_file_id", "most_recent"], name: "index_user_export_file_transitions_parent_most_recent", unique: true, where: "most_recent"
1181
1271
  t.index ["user_export_file_id"], name: "index_user_export_file_transitions_on_file_id"
1182
1272
  t.index ["user_export_file_id"], name: "index_user_export_file_transitions_on_user_export_file_id"
1183
1273
  end
@@ -1217,7 +1307,7 @@ ActiveRecord::Schema.define(version: 20180102162311) do
1217
1307
  t.string "name"
1218
1308
  t.text "display_name"
1219
1309
  t.text "note"
1220
- t.integer "position"
1310
+ t.integer "position", default: 1, null: false
1221
1311
  t.datetime "created_at"
1222
1312
  t.datetime "updated_at"
1223
1313
  t.datetime "deleted_at"
@@ -1244,8 +1334,9 @@ ActiveRecord::Schema.define(version: 20180102162311) do
1244
1334
  t.integer "user_import_file_id"
1245
1335
  t.datetime "created_at"
1246
1336
  t.datetime "updated_at"
1247
- t.boolean "most_recent"
1337
+ t.boolean "most_recent", null: false
1248
1338
  t.index ["sort_key", "user_import_file_id"], name: "index_user_import_file_transitions_on_sort_key_and_file_id", unique: true
1339
+ t.index ["user_import_file_id", "most_recent"], name: "index_user_import_file_transitions_parent_most_recent", unique: true, where: "most_recent"
1249
1340
  t.index ["user_import_file_id"], name: "index_user_import_file_transitions_on_user_import_file_id"
1250
1341
  end
1251
1342
 
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require 'spec_helper'
3
2
 
4
3
  describe UserHasRole do
@@ -5,7 +5,7 @@ describe "profiles/show" do
5
5
 
6
6
  before(:each) do
7
7
  @profile = assign(:profile, profiles(:admin))
8
- view.stub(:current_user).and_return(User.friendly.find('enjuadmin'))
8
+ view.stub(:current_user).and_return(User.find_by(username: 'enjuadmin'))
9
9
  end
10
10
 
11
11
  describe "when logged in as Librarian" do
@@ -0,0 +1,18 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "roles/edit", type: :view do
4
+ before(:each) do
5
+ @role = assign(:role, Role.create!(
6
+ :name => "my_string"
7
+ ))
8
+ end
9
+
10
+ it "renders the edit role form" do
11
+ render
12
+
13
+ assert_select "form[action=?][method=?]", role_path(@role), "post" do
14
+
15
+ assert_select "input[name=?]", "role[name]"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "roles/index", type: :view do
4
+ fixtures :roles
5
+ before(:each) do
6
+ assign(:roles, Role.all)
7
+ end
8
+
9
+ it "renders a list of roles" do
10
+ allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
11
+ render
12
+ assert_select "tr>td", text: "Librarian".to_s, count: 2
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "roles/new", type: :view do
4
+ before(:each) do
5
+ assign(:role, Role.new(
6
+ :name => "my_string"
7
+ ))
8
+ end
9
+
10
+ it "renders new role form" do
11
+ render
12
+
13
+ assert_select "form[action=?][method=?]", roles_path, "post" do
14
+
15
+ assert_select "input[name=?]", "role[name]"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe "roles/show", type: :view do
4
+ fixtures :roles
5
+ before(:each) do
6
+ @role = assign(:role, Role.find_by(name: 'User'))
7
+ end
8
+
9
+ it "renders attributes in <p>" do
10
+ allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
11
+ render
12
+ expect(rendered).to match(/User/)
13
+ end
14
+ end