global-registry-bindings 0.6.2 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/lib/global_registry_bindings/entity/entity_type_methods.rb +16 -18
  3. data/lib/global_registry_bindings/entity/mdm_methods.rb +11 -12
  4. data/lib/global_registry_bindings/entity/push_entity_methods.rb +23 -23
  5. data/lib/global_registry_bindings/entity/push_relationship_methods.rb +18 -18
  6. data/lib/global_registry_bindings/entity/relationship_type_methods.rb +26 -26
  7. data/lib/global_registry_bindings/exceptions.rb +7 -2
  8. data/lib/global_registry_bindings/global_registry_bindings.rb +19 -19
  9. data/lib/global_registry_bindings/model/delete_entity.rb +4 -4
  10. data/lib/global_registry_bindings/model/entity.rb +25 -25
  11. data/lib/global_registry_bindings/model/pull_mdm.rb +5 -5
  12. data/lib/global_registry_bindings/model/push_entity.rb +4 -4
  13. data/lib/global_registry_bindings/model/push_relationship.rb +10 -8
  14. data/lib/global_registry_bindings/model/relationship.rb +18 -18
  15. data/lib/global_registry_bindings/options/entity_class_options.rb +15 -15
  16. data/lib/global_registry_bindings/options/entity_instance_options.rb +11 -11
  17. data/lib/global_registry_bindings/options/entity_options_parser.rb +3 -3
  18. data/lib/global_registry_bindings/options/relationship_class_options.rb +22 -22
  19. data/lib/global_registry_bindings/options/relationship_instance_options.rb +12 -12
  20. data/lib/global_registry_bindings/options/relationship_options_parser.rb +7 -7
  21. data/lib/global_registry_bindings/options.rb +6 -6
  22. data/lib/global_registry_bindings/railtie.rb +7 -7
  23. data/lib/global_registry_bindings/testing.rb +3 -3
  24. data/lib/global_registry_bindings/version.rb +3 -3
  25. data/lib/global_registry_bindings/worker.rb +5 -5
  26. data/lib/global_registry_bindings/workers/delete_entity_worker.rb +3 -3
  27. data/lib/global_registry_bindings/workers/pull_mdm_id_worker.rb +5 -5
  28. data/lib/global_registry_bindings/workers/push_entity_worker.rb +6 -6
  29. data/lib/global_registry_bindings/workers/push_relationship_worker.rb +6 -6
  30. data/lib/global_registry_bindings.rb +3 -3
  31. metadata +15 -155
  32. data/spec/acceptance/global_registry_bindings_spec.rb +0 -191
  33. data/spec/factories/factories.rb +0 -72
  34. data/spec/fixtures/get_entities_person.json +0 -8
  35. data/spec/fixtures/get_entities_person_mdm.json +0 -13
  36. data/spec/fixtures/get_entities_person_relationship.json +0 -32
  37. data/spec/fixtures/get_entity_types.json +0 -9
  38. data/spec/fixtures/get_entity_types_address.json +0 -59
  39. data/spec/fixtures/get_entity_types_address_partial.json +0 -43
  40. data/spec/fixtures/get_entity_types_area.json +0 -44
  41. data/spec/fixtures/get_entity_types_community.json +0 -18
  42. data/spec/fixtures/get_entity_types_fancy_org.json +0 -43
  43. data/spec/fixtures/get_entity_types_fancy_org_assignment.json +0 -35
  44. data/spec/fixtures/get_entity_types_fancy_org_partial.json +0 -35
  45. data/spec/fixtures/get_entity_types_ministry.json +0 -18
  46. data/spec/fixtures/get_entity_types_person.json +0 -42
  47. data/spec/fixtures/get_entity_types_person_partial.json +0 -34
  48. data/spec/fixtures/get_relationship_types.json +0 -9
  49. data/spec/fixtures/get_relationship_types_person_fancy_org.json +0 -41
  50. data/spec/fixtures/get_relationship_types_person_fancy_org_partial.json +0 -33
  51. data/spec/fixtures/post_entities_community.json +0 -8
  52. data/spec/fixtures/post_entities_fancy_org.json +0 -8
  53. data/spec/fixtures/post_entities_fancy_org_parent.json +0 -8
  54. data/spec/fixtures/post_entities_person.json +0 -8
  55. data/spec/fixtures/post_entity_types_address.json +0 -9
  56. data/spec/fixtures/post_entity_types_fancy_org.json +0 -9
  57. data/spec/fixtures/post_entity_types_person.json +0 -9
  58. data/spec/fixtures/post_relationship_types_assigned_by.json +0 -16
  59. data/spec/fixtures/post_relationship_types_community_ministry.json +0 -16
  60. data/spec/fixtures/post_relationship_types_fancy_org_area.json +0 -16
  61. data/spec/fixtures/post_relationship_types_person_fancy_org.json +0 -16
  62. data/spec/fixtures/put_entities_address.json +0 -20
  63. data/spec/fixtures/put_entities_community_relationship.json +0 -16
  64. data/spec/fixtures/put_entities_fancy_org_area_relationship.json +0 -8
  65. data/spec/fixtures/put_entities_fancy_org_assignment_assigned_by.json +0 -20
  66. data/spec/fixtures/put_entities_fancy_org_relationship.json +0 -17
  67. data/spec/fixtures/put_entities_person_country_relationship.json +0 -23
  68. data/spec/fixtures/put_entities_person_relationship.json +0 -29
  69. data/spec/fixtures/put_entities_relationship.json +0 -8
  70. data/spec/fixtures/put_entities_relationship_400.json +0 -3
  71. data/spec/fixtures/put_relationship_types_fields.json +0 -33
  72. data/spec/fixtures/put_relationship_types_fields_fancy_org_area.json +0 -25
  73. data/spec/helpers/sidekiq_helpers.rb +0 -14
  74. data/spec/internal/app/models/address.rb +0 -17
  75. data/spec/internal/app/models/application_record.rb +0 -5
  76. data/spec/internal/app/models/area.rb +0 -7
  77. data/spec/internal/app/models/assignment.rb +0 -21
  78. data/spec/internal/app/models/community.rb +0 -20
  79. data/spec/internal/app/models/country.rb +0 -8
  80. data/spec/internal/app/models/default.rb +0 -6
  81. data/spec/internal/app/models/namespaced/person/user_edited.rb +0 -8
  82. data/spec/internal/app/models/namespaced/person.rb +0 -68
  83. data/spec/internal/app/models/organization.rb +0 -37
  84. data/spec/internal/config/database.yml +0 -4
  85. data/spec/internal/config/initializers/global_registry.rb +0 -8
  86. data/spec/internal/config/routes.rb +0 -5
  87. data/spec/internal/db/schema.rb +0 -75
  88. data/spec/internal/db/test.sqlite +0 -0
  89. data/spec/internal/log/test.log +0 -1457
  90. data/spec/models/address_spec.rb +0 -30
  91. data/spec/models/assignment_spec.rb +0 -54
  92. data/spec/models/organization_spec.rb +0 -125
  93. data/spec/models/person_spec.rb +0 -191
  94. data/spec/models/testing_spec.rb +0 -55
  95. data/spec/models/user_edited_person_spec.rb +0 -14
  96. data/spec/options/if_unless_spec.rb +0 -147
  97. data/spec/spec_helper.rb +0 -52
  98. data/spec/workers/delete_gr_entity_worker_spec.rb +0 -33
  99. data/spec/workers/pull_mdm_id_worker_spec.rb +0 -133
  100. data/spec/workers/push_entity_worker_spec.rb +0 -506
  101. data/spec/workers/push_relationship_worker_spec.rb +0 -503
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: global-registry-bindings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: '0.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Zoetewey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-30 00:00:00.000000000 Z
11
+ date: 2023-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 4.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7'
22
+ version: '8'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 4.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7'
32
+ version: '8'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: global_registry
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -184,16 +184,16 @@ dependencies:
184
184
  name: rspec-rails
185
185
  requirement: !ruby/object:Gem::Requirement
186
186
  requirements:
187
- - - "~>"
187
+ - - ">="
188
188
  - !ruby/object:Gem::Version
189
- version: 3.5.0
189
+ version: '0'
190
190
  type: :development
191
191
  prerelease: false
192
192
  version_requirements: !ruby/object:Gem::Requirement
193
193
  requirements:
194
- - - "~>"
194
+ - - ">="
195
195
  - !ruby/object:Gem::Version
196
- version: 3.5.0
196
+ version: '0'
197
197
  - !ruby/object:Gem::Dependency
198
198
  name: webmock
199
199
  requirement: !ruby/object:Gem::Requirement
@@ -223,19 +223,19 @@ dependencies:
223
223
  - !ruby/object:Gem::Version
224
224
  version: 4.8.0
225
225
  - !ruby/object:Gem::Dependency
226
- name: rubocop
226
+ name: standard
227
227
  requirement: !ruby/object:Gem::Requirement
228
228
  requirements:
229
- - - '='
229
+ - - ">="
230
230
  - !ruby/object:Gem::Version
231
- version: 0.48.1
231
+ version: '0'
232
232
  type: :development
233
233
  prerelease: false
234
234
  version_requirements: !ruby/object:Gem::Requirement
235
235
  requirements:
236
- - - '='
236
+ - - ">="
237
237
  - !ruby/object:Gem::Version
238
- version: 0.48.1
238
+ version: '0'
239
239
  - !ruby/object:Gem::Dependency
240
240
  name: sqlite3
241
241
  requirement: !ruby/object:Gem::Requirement
@@ -345,76 +345,6 @@ files:
345
345
  - lib/global_registry_bindings/workers/pull_mdm_id_worker.rb
346
346
  - lib/global_registry_bindings/workers/push_entity_worker.rb
347
347
  - lib/global_registry_bindings/workers/push_relationship_worker.rb
348
- - spec/acceptance/global_registry_bindings_spec.rb
349
- - spec/factories/factories.rb
350
- - spec/fixtures/get_entities_person.json
351
- - spec/fixtures/get_entities_person_mdm.json
352
- - spec/fixtures/get_entities_person_relationship.json
353
- - spec/fixtures/get_entity_types.json
354
- - spec/fixtures/get_entity_types_address.json
355
- - spec/fixtures/get_entity_types_address_partial.json
356
- - spec/fixtures/get_entity_types_area.json
357
- - spec/fixtures/get_entity_types_community.json
358
- - spec/fixtures/get_entity_types_fancy_org.json
359
- - spec/fixtures/get_entity_types_fancy_org_assignment.json
360
- - spec/fixtures/get_entity_types_fancy_org_partial.json
361
- - spec/fixtures/get_entity_types_ministry.json
362
- - spec/fixtures/get_entity_types_person.json
363
- - spec/fixtures/get_entity_types_person_partial.json
364
- - spec/fixtures/get_relationship_types.json
365
- - spec/fixtures/get_relationship_types_person_fancy_org.json
366
- - spec/fixtures/get_relationship_types_person_fancy_org_partial.json
367
- - spec/fixtures/post_entities_community.json
368
- - spec/fixtures/post_entities_fancy_org.json
369
- - spec/fixtures/post_entities_fancy_org_parent.json
370
- - spec/fixtures/post_entities_person.json
371
- - spec/fixtures/post_entity_types_address.json
372
- - spec/fixtures/post_entity_types_fancy_org.json
373
- - spec/fixtures/post_entity_types_person.json
374
- - spec/fixtures/post_relationship_types_assigned_by.json
375
- - spec/fixtures/post_relationship_types_community_ministry.json
376
- - spec/fixtures/post_relationship_types_fancy_org_area.json
377
- - spec/fixtures/post_relationship_types_person_fancy_org.json
378
- - spec/fixtures/put_entities_address.json
379
- - spec/fixtures/put_entities_community_relationship.json
380
- - spec/fixtures/put_entities_fancy_org_area_relationship.json
381
- - spec/fixtures/put_entities_fancy_org_assignment_assigned_by.json
382
- - spec/fixtures/put_entities_fancy_org_relationship.json
383
- - spec/fixtures/put_entities_person_country_relationship.json
384
- - spec/fixtures/put_entities_person_relationship.json
385
- - spec/fixtures/put_entities_relationship.json
386
- - spec/fixtures/put_entities_relationship_400.json
387
- - spec/fixtures/put_relationship_types_fields.json
388
- - spec/fixtures/put_relationship_types_fields_fancy_org_area.json
389
- - spec/helpers/sidekiq_helpers.rb
390
- - spec/internal/app/models/address.rb
391
- - spec/internal/app/models/application_record.rb
392
- - spec/internal/app/models/area.rb
393
- - spec/internal/app/models/assignment.rb
394
- - spec/internal/app/models/community.rb
395
- - spec/internal/app/models/country.rb
396
- - spec/internal/app/models/default.rb
397
- - spec/internal/app/models/namespaced/person.rb
398
- - spec/internal/app/models/namespaced/person/user_edited.rb
399
- - spec/internal/app/models/organization.rb
400
- - spec/internal/config/database.yml
401
- - spec/internal/config/initializers/global_registry.rb
402
- - spec/internal/config/routes.rb
403
- - spec/internal/db/schema.rb
404
- - spec/internal/db/test.sqlite
405
- - spec/internal/log/test.log
406
- - spec/models/address_spec.rb
407
- - spec/models/assignment_spec.rb
408
- - spec/models/organization_spec.rb
409
- - spec/models/person_spec.rb
410
- - spec/models/testing_spec.rb
411
- - spec/models/user_edited_person_spec.rb
412
- - spec/options/if_unless_spec.rb
413
- - spec/spec_helper.rb
414
- - spec/workers/delete_gr_entity_worker_spec.rb
415
- - spec/workers/pull_mdm_id_worker_spec.rb
416
- - spec/workers/push_entity_worker_spec.rb
417
- - spec/workers/push_relationship_worker_spec.rb
418
348
  homepage: https://github.com/CruGlobal/global-registry-bindings
419
349
  licenses:
420
350
  - MIT
@@ -434,78 +364,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
434
364
  - !ruby/object:Gem::Version
435
365
  version: '0'
436
366
  requirements: []
437
- rubygems_version: 3.3.6
367
+ rubygems_version: 3.0.3.1
438
368
  signing_key:
439
369
  specification_version: 4
440
370
  summary: ActiveRecord bindings for Global Registry
441
- test_files:
442
- - spec/spec_helper.rb
443
- - spec/options/if_unless_spec.rb
444
- - spec/internal/app/models/area.rb
445
- - spec/internal/app/models/namespaced/person/user_edited.rb
446
- - spec/internal/app/models/namespaced/person.rb
447
- - spec/internal/app/models/assignment.rb
448
- - spec/internal/app/models/default.rb
449
- - spec/internal/app/models/country.rb
450
- - spec/internal/app/models/community.rb
451
- - spec/internal/app/models/organization.rb
452
- - spec/internal/app/models/application_record.rb
453
- - spec/internal/app/models/address.rb
454
- - spec/internal/config/routes.rb
455
- - spec/internal/config/database.yml
456
- - spec/internal/config/initializers/global_registry.rb
457
- - spec/internal/db/schema.rb
458
- - spec/internal/db/test.sqlite
459
- - spec/internal/log/test.log
460
- - spec/models/person_spec.rb
461
- - spec/models/testing_spec.rb
462
- - spec/models/assignment_spec.rb
463
- - spec/models/organization_spec.rb
464
- - spec/models/user_edited_person_spec.rb
465
- - spec/models/address_spec.rb
466
- - spec/acceptance/global_registry_bindings_spec.rb
467
- - spec/factories/factories.rb
468
- - spec/fixtures/post_relationship_types_community_ministry.json
469
- - spec/fixtures/get_entity_types_fancy_org_partial.json
470
- - spec/fixtures/post_entities_person.json
471
- - spec/fixtures/get_entity_types_area.json
472
- - spec/fixtures/post_relationship_types_fancy_org_area.json
473
- - spec/fixtures/put_entities_person_country_relationship.json
474
- - spec/fixtures/get_entity_types_person.json
475
- - spec/fixtures/get_entity_types_community.json
476
- - spec/fixtures/post_relationship_types_person_fancy_org.json
477
- - spec/fixtures/get_entity_types_address_partial.json
478
- - spec/fixtures/get_entity_types_fancy_org_assignment.json
479
- - spec/fixtures/put_entities_fancy_org_area_relationship.json
480
- - spec/fixtures/get_entities_person_mdm.json
481
- - spec/fixtures/put_entities_address.json
482
- - spec/fixtures/get_entity_types_fancy_org.json
483
- - spec/fixtures/post_entity_types_address.json
484
- - spec/fixtures/post_relationship_types_assigned_by.json
485
- - spec/fixtures/get_entity_types.json
486
- - spec/fixtures/put_entities_relationship.json
487
- - spec/fixtures/put_entities_relationship_400.json
488
- - spec/fixtures/put_entities_fancy_org_assignment_assigned_by.json
489
- - spec/fixtures/get_relationship_types.json
490
- - spec/fixtures/post_entity_types_fancy_org.json
491
- - spec/fixtures/get_entity_types_ministry.json
492
- - spec/fixtures/get_relationship_types_person_fancy_org.json
493
- - spec/fixtures/put_entities_person_relationship.json
494
- - spec/fixtures/post_entities_fancy_org.json
495
- - spec/fixtures/get_entity_types_address.json
496
- - spec/fixtures/get_entity_types_person_partial.json
497
- - spec/fixtures/post_entity_types_person.json
498
- - spec/fixtures/post_entities_fancy_org_parent.json
499
- - spec/fixtures/get_entities_person.json
500
- - spec/fixtures/put_relationship_types_fields_fancy_org_area.json
501
- - spec/fixtures/put_entities_community_relationship.json
502
- - spec/fixtures/post_entities_community.json
503
- - spec/fixtures/get_relationship_types_person_fancy_org_partial.json
504
- - spec/fixtures/put_relationship_types_fields.json
505
- - spec/fixtures/get_entities_person_relationship.json
506
- - spec/fixtures/put_entities_fancy_org_relationship.json
507
- - spec/workers/push_entity_worker_spec.rb
508
- - spec/workers/push_relationship_worker_spec.rb
509
- - spec/workers/pull_mdm_id_worker_spec.rb
510
- - spec/workers/delete_gr_entity_worker_spec.rb
511
- - spec/helpers/sidekiq_helpers.rb
371
+ test_files: []
@@ -1,191 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe 'GlobalRegistry::Bindings' do
6
- describe 'ActiveRecord::Base extensions' do
7
- it 'should respond to global_registry_bindings' do
8
- expect(::ActiveRecord::Base).to respond_to :global_registry_bindings
9
- end
10
- end
11
-
12
- describe 'Options' do
13
- it 'should have default values for all options' do
14
- expect(Default.global_registry_entity.id_column).to be :global_registry_id
15
- expect(Default.global_registry_entity.mdm_id_column).to be nil
16
- expect(Default.global_registry_entity.parent).to be nil
17
- expect(Default.global_registry_entity.push_on)
18
- .to contain_exactly(:create, :update, :destroy)
19
- expect(Default.global_registry_entity.mdm_timeout).to eq 1.minute
20
- expect(Default.global_registry_entity.type).to be :default
21
- expect(Default.global_registry_entity.exclude)
22
- .to contain_exactly(:global_registry_id, :id, :created_at, :updated_at)
23
- expect(Default.global_registry_entity.fields).to be_a(Hash).and be_empty
24
- end
25
-
26
- it 'should parse and set mdm options' do
27
- expect(Namespaced::Person.global_registry_entity.id_column).to be :global_registry_id
28
- expect(Namespaced::Person.global_registry_entity.mdm_id_column).to be :global_registry_mdm_id
29
- expect(Namespaced::Person.global_registry_entity.mdm_timeout).to eq 24.hours
30
- expect(Namespaced::Person.global_registry_entity.type).to be :person
31
- expect(Namespaced::Person.global_registry_entity.exclude)
32
- .to contain_exactly(:country_of_residence_gr_id, :country_of_residence_id, :country_of_service_gr_id,
33
- :country_of_service_id, :created_at, :global_registry_id, :global_registry_mdm_id,
34
- :guid, :id, :updated_at, :global_registry_fingerprint)
35
- expect(Namespaced::Person.global_registry_entity.fields).to be_a(Hash).and be_empty
36
- expect(GlobalRegistry::Bindings::Workers::PullNamespacedPersonMdmIdWorker.get_sidekiq_options)
37
- .to include('unique' => :until_timeout, 'unique_expiration' => 24.hours)
38
- end
39
-
40
- it 'should parse and set exclude and extra fields options' do
41
- address = build(:address)
42
- expect(Address.global_registry_entity.id_column).to be :global_registry_id
43
- expect(Address.global_registry_entity.mdm_id_column).to be nil
44
- expect(Address.global_registry_entity.type).to be :address
45
- expect(Address.global_registry_entity.parent).to be :person
46
- expect(Address.global_registry_entity.exclude).to be_a Proc
47
- expect(address.global_registry_entity.exclude)
48
- .to contain_exactly(:global_registry_id, :id, :created_at, :updated_at, :person_id, :address1)
49
- expect(Address.global_registry_entity.fields).to be_a Symbol
50
- expect(address.global_registry_entity.fields)
51
- .to include(line1: :string, postal_code: :string)
52
- end
53
-
54
- it 'should parse and set push_on fields' do
55
- org = build(:organization)
56
- expect(Organization.global_registry_entity.id_column).to be :gr_id
57
- expect(Organization.global_registry_entity.mdm_id_column).to be nil
58
- expect(Organization.global_registry_entity.type).to be_a Proc
59
- expect(org.global_registry_entity.type).to be :fancy_org
60
- expect(Organization.global_registry_entity.parent).to be :parent
61
- expect(Organization.global_registry_entity.push_on).to be_an(Array).and eq(%i[create destroy])
62
- expect(Organization.global_registry_entity.exclude).to be_a Symbol
63
- expect(org.global_registry_entity.exclude)
64
- .to contain_exactly(:gr_id, :id, :created_at, :updated_at, :parent_id, :area_id, :global_registry_area_id)
65
- expect(Organization.global_registry_entity.fields).to be_a Proc
66
- expect(org.global_registry_entity.fields).to be_a(Hash).and be_empty
67
- end
68
-
69
- it 'should parse and set relationship fields' do
70
- person = build(:person)
71
- org = build(:organization)
72
- assignment = build(:assignment, person: person, organization: org)
73
- expect(Assignment.global_registry_relationship(:fancy_org_assignment).id_column).to be :global_registry_id
74
- expect(Assignment.global_registry_relationship(:fancy_org_assignment).type).to be :fancy_org_assignment
75
- expect(Assignment.global_registry_relationship(:fancy_org_assignment).primary).to be :person
76
- expect(Assignment.global_registry_relationship(:fancy_org_assignment).related).to be :organization
77
- expect(assignment.global_registry_relationship(:fancy_org_assignment).primary_name).to be :person
78
- expect(assignment.global_registry_relationship(:fancy_org_assignment).related_name).to be :fancy_org
79
- expect(assignment.global_registry_relationship(:fancy_org_assignment).exclude)
80
- .to contain_exactly(:global_registry_id, :id, :created_at, :updated_at, :person_id, :organization_id,
81
- :assigned_by_gr_rel_id, :assigned_by_id)
82
- expect(assignment.global_registry_relationship(:fancy_org_assignment).fields)
83
- .to be_a(Hash)
84
- end
85
- end
86
-
87
- describe 'configure' do
88
- it 'should have default sidekiq_options' do
89
- expect(GlobalRegistry::Bindings.sidekiq_options).to be_a(Hash).and be_empty
90
- end
91
-
92
- it 'should have default redis_error_action' do
93
- expect(GlobalRegistry::Bindings.redis_error_action).to be :log
94
- end
95
-
96
- context 'custom sidekiq queue' do
97
- before do
98
- GlobalRegistry::Bindings.configure do |config|
99
- config.sidekiq_options = { queue: :custom }
100
- end
101
- end
102
- after do
103
- GlobalRegistry::Bindings.configure do |config|
104
- config.sidekiq_options = {}
105
- end
106
- end
107
- let(:job) do
108
- GlobalRegistry::Bindings::Workers::DeleteEntityWorker.perform_async(123)
109
- GlobalRegistry::Bindings::Workers::DeleteEntityWorker.jobs.last
110
- end
111
-
112
- it 'should contain global custom queue' do
113
- expect(GlobalRegistry::Bindings.sidekiq_options).to be_a(Hash).and(include(queue: :custom))
114
- expect(job).to include('queue' => 'custom')
115
- end
116
- end
117
-
118
- describe 'redis_error_action' do
119
- around do |example|
120
- class Rollbar; end
121
- example.run
122
- Object.send(:remove_const, :Rollbar)
123
- end
124
-
125
- context ':ignore' do
126
- around do |example|
127
- GlobalRegistry::Bindings.configure do |config|
128
- config.redis_error_action = :ignore
129
- end
130
- example.run
131
- GlobalRegistry::Bindings.configure do |config|
132
- config.redis_error_action = :log
133
- end
134
- end
135
-
136
- it 'should silently ignore redis errors' do
137
- allow(Rollbar).to receive(:error)
138
- expect(GlobalRegistry::Bindings::Worker).to receive(:set).and_raise(Redis::BaseError)
139
- expect do
140
- GlobalRegistry::Bindings::Worker.perform_async
141
- end.to_not raise_error
142
- expect(GlobalRegistry::Bindings::Worker.jobs.size).to be 0
143
- expect(Rollbar).not_to have_received(:error)
144
- end
145
- end
146
-
147
- context ':log' do
148
- around do |example|
149
- GlobalRegistry::Bindings.configure do |config|
150
- config.redis_error_action = :log
151
- end
152
- example.run
153
- GlobalRegistry::Bindings.configure do |config|
154
- config.redis_error_action = :log
155
- end
156
- end
157
-
158
- it 'should log redis errors' do
159
- allow(Rollbar).to receive(:error)
160
- expect(GlobalRegistry::Bindings::Worker).to receive(:set).and_raise(Redis::BaseError)
161
- expect do
162
- GlobalRegistry::Bindings::Worker.perform_async
163
- end.to_not raise_error
164
- expect(GlobalRegistry::Bindings::Worker.jobs.size).to be 0
165
- expect(Rollbar).to have_received(:error)
166
- end
167
- end
168
-
169
- context ':raise' do
170
- around do |example|
171
- GlobalRegistry::Bindings.configure do |config|
172
- config.redis_error_action = :raise
173
- end
174
- example.run
175
- GlobalRegistry::Bindings.configure do |config|
176
- config.redis_error_action = :log
177
- end
178
- end
179
-
180
- it 'should re-raise redis errors' do
181
- allow(Rollbar).to receive(:error)
182
- expect(GlobalRegistry::Bindings::Worker).to receive(:set).and_raise(Redis::BaseError)
183
- expect do
184
- GlobalRegistry::Bindings::Worker.perform_async
185
- end.to raise_error(Redis::BaseError)
186
- expect(GlobalRegistry::Bindings::Worker.jobs.size).to be 0
187
- end
188
- end
189
- end
190
- end
191
- end
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'securerandom'
4
-
5
- FactoryGirl.define do
6
- factory :person, class: Namespaced::Person do
7
- first_name 'Tony'
8
- last_name 'Stark'
9
- guid '98711710-acb5-4a41-ba51-e0fc56644b53'
10
- global_registry_id nil
11
- global_registry_mdm_id nil
12
- global_registry_fingerprint nil
13
- country_of_service_id nil
14
- country_of_service_gr_id nil
15
- country_of_residence_id nil
16
- country_of_residence_gr_id nil
17
- end
18
-
19
- factory :user_edited, class: Namespaced::Person::UserEdited do
20
- first_name 'Bruce'
21
- last_name 'Banner'
22
- guid 'e4b665fe-df98-46b4-adb8-e878669dcdd4'
23
- global_registry_id nil
24
- global_registry_mdm_id nil
25
- end
26
-
27
- factory :address do
28
- address1 '10880 Malibu Point'
29
- zip '90265'
30
- primary true
31
- global_registry_id nil
32
- person_id nil
33
- end
34
-
35
- factory :organization do
36
- name 'Organization'
37
- description 'Fancy Organization'
38
- start_date { Time.zone.today }
39
- parent_id nil
40
- gr_id nil
41
- area_id nil
42
- global_registry_area_id nil
43
- end
44
-
45
- factory :assignment do
46
- role 'leader'
47
- hired_at { 2.months.ago }
48
- person_id nil
49
- organization_id nil
50
- global_registry_id nil
51
- assigned_by_id nil
52
- assigned_by_gr_rel_id nil
53
- end
54
-
55
- factory :area do
56
- area_name 'Best Area'
57
- area_code 'BEST'
58
- is_active true
59
- end
60
-
61
- factory :country do
62
- global_registry_id nil
63
- name 'Sokovia'
64
- end
65
-
66
- factory :community do
67
- global_registry_id nil
68
- infobase_gr_id nil
69
- name 'Community'
70
- infobase_id 1
71
- end
72
- end
@@ -1,8 +0,0 @@
1
- {
2
- "entity": {
3
- "person": {
4
- "id": "22527d88-3cba-11e7-b876-129bd0521531"
5
- }
6
- },
7
- "meta": {}
8
- }
@@ -1,13 +0,0 @@
1
- {
2
- "entity": {
3
- "person": {
4
- "id": "22527d88-3cba-11e7-b876-129bd0521531",
5
- "master_person:relationship": {
6
- "master_person": "c81340b2-7e57-4978-b6b9-396f21bb0bb2",
7
- "relationship_entity_id": "31d8465a-f9ff-11e6-9e00-1228c4aab4b9",
8
- "client_integration_id": "16a96973-6240-449b-adec-757c7da31b17"
9
- }
10
- }
11
- },
12
- "meta": {}
13
- }
@@ -1,32 +0,0 @@
1
- {
2
- "entity": {
3
- "person": {
4
- "id": "22527d88-3cba-11e7-b876-129bd0521531",
5
- "first_name": "Tony",
6
- "last_name": "Stark",
7
- "authentication": {
8
- "id": "9484718a-3cbb-11e7-b876-129bd0521531",
9
- "key_guid": "8ec978ef-0b44-4ba1-ab32-1b6cae8aeb17",
10
- "parent_id": "22527d88-3cba-11e7-b876-129bd0521531",
11
- "client_integration_id": "1"
12
- },
13
- "address": {
14
- "id": "0a594356-3f1c-11e7-bba6-129bd0521531",
15
- "zip": "90265",
16
- "primary": true,
17
- "line1": "10880 Malibu Point",
18
- "postal_code": "90265",
19
- "parent_id": "22527d88-3cba-11e7-b876-129bd0521531",
20
- "client_integration_id": "1",
21
- "client_updated_at": "2001-02-03 00:00:00"
22
- },
23
- "fancy_org:relationship": {
24
- "fancy_org": "aebb4170-3f34-11e7-bba6-129bd0521531",
25
- "relationship_entity_id": "51a014a4-4252-11e7-944f-129bd0521531",
26
- "client_integration_id": "1",
27
- "role": "peon"
28
- },
29
- "client_integration_id": "1"
30
- }
31
- }
32
- }
@@ -1,9 +0,0 @@
1
- {
2
- "entity_types": [],
3
- "meta": {
4
- "page": 1,
5
- "next_page": false,
6
- "from": 1,
7
- "to": 1
8
- }
9
- }
@@ -1,59 +0,0 @@
1
- {
2
- "entity_types": [
3
- {
4
- "id": "f5331684-3ca8-11e7-b937-129bd0521531",
5
- "name": "address",
6
- "data_visibility": "public",
7
- "fields": [
8
- {
9
- "id": "26f131be-3f1b-11e7-925c-129bd0521531",
10
- "name": "zip",
11
- "data_visibility": "public",
12
- "field_type": "string",
13
- "is_editable": true,
14
- "unique_value": false
15
- },
16
- {
17
- "id": "2dc5993a-3f1b-11e7-b876-129bd0521531",
18
- "name": "line1",
19
- "data_visibility": "public",
20
- "field_type": "string",
21
- "is_editable": true,
22
- "unique_value": false
23
- },
24
- {
25
- "id": "30bec83c-3f1b-11e7-b876-129bd0521531",
26
- "name": "line2",
27
- "data_visibility": "public",
28
- "field_type": "string",
29
- "is_editable": true,
30
- "unique_value": false
31
- },
32
- {
33
- "id": "40db6be4-3f1b-11e7-b876-129bd0521531",
34
- "name": "primary",
35
- "data_visibility": "public",
36
- "field_type": "boolean",
37
- "is_editable": true,
38
- "unique_value": false
39
- },
40
- {
41
- "id": "48181a92-3f1b-11e7-bba6-129bd0521531",
42
- "name": "postal_code",
43
- "data_visibility": "public",
44
- "field_type": "string",
45
- "is_editable": true,
46
- "unique_value": false
47
- }
48
- ],
49
- "is_editable": true,
50
- "unique_value": false
51
- }
52
- ],
53
- "meta": {
54
- "page": 1,
55
- "next_page": false,
56
- "from": 1,
57
- "to": 1
58
- }
59
- }
@@ -1,43 +0,0 @@
1
- {
2
- "entity_types": [
3
- {
4
- "id": "f5331684-3ca8-11e7-b937-129bd0521531",
5
- "name": "address",
6
- "data_visibility": "public",
7
- "fields": [
8
- {
9
- "id": "26f131be-3f1b-11e7-925c-129bd0521531",
10
- "name": "zip",
11
- "data_visibility": "public",
12
- "field_type": "string",
13
- "is_editable": true,
14
- "unique_value": false
15
- },
16
- {
17
- "id": "2dc5993a-3f1b-11e7-b876-129bd0521531",
18
- "name": "line1",
19
- "data_visibility": "public",
20
- "field_type": "string",
21
- "is_editable": true,
22
- "unique_value": false
23
- },
24
- {
25
- "id": "48181a92-3f1b-11e7-bba6-129bd0521531",
26
- "name": "postal_code",
27
- "data_visibility": "public",
28
- "field_type": "string",
29
- "is_editable": true,
30
- "unique_value": false
31
- }
32
- ],
33
- "is_editable": true,
34
- "unique_value": false
35
- }
36
- ],
37
- "meta": {
38
- "page": 1,
39
- "next_page": false,
40
- "from": 1,
41
- "to": 1
42
- }
43
- }